Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


When piping to a response, and an error occurs, end the response #6

merged 1 commit into from

2 participants

Nicolas Chambrier Mikeal Rogers
Nicolas Chambrier

For the moment the samples in documentation won't work with unexisting files. In those cases, the stream is ended, but not the response.
Plus, as there is no data passed with the "end" event of the stream, there is no clean way to detect why it has been ended and then properly end the response on the other side.
So I propose to end the response directly (as expected from documentation), when such an error occurs.

Mikeal Rogers mikeal merged commit 5bad464 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 2 deletions.
  1. +2 −2 main.js
4 main.js
@@ -72,10 +72,10 @@ function File (options) {
) {
if (err.code === 'ENOENT') {
self.dest.statusCode = 404
- self.end('Not Found')
+ self.dest.end('Not Found')
} else {
self.dest.statusCode = 500
- self.end(err.message)
+ self.dest.end(err.message)
Something went wrong with that request. Please try again.