Skip to content
Myr

Misc refactoring to Request#stream()

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by visionmedia · committed by visionmedia · parent 2ccf876 · Browse files · 1 file+4 added−5 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+4 added−5 removed

  • other:+4 added−5 removed

1 file+4 added−5 removed

modified:lib/express/request.js+4 added-5 removed
199 unmodified lines
200 }, true)201 },202 203 /**204 * Transfer the given _stream_.204 * Transfer the given _stream_ with optional _callback_.205 *206 * @param {Stream} stream207 * @return {Request}208 * @api public
7 unmodified lines
216 if (first)217 return 'errno' in err && err.errno === 2218 ? self.notFound()219 : self.error(err)220 // TODO: err wtf ? bad file descriptor apparently...220 self.response.end()221 if (callback !== undefined) callback(err)222 })223 .addListener('data', function(data){224 if (first) {225 self.status(200)226 first = false227 self.contentType(stream.path)228 self.response.writeHeader(self.response.status, self.response.headers)229 self.response.write(data, 'binary')230 } else231 self.response.write(data, 'binary')229 }230 self.response.write(data, 'binary')231 })232 .addListener('end', function(){233 self.response.end()234 self.trigger('response', function(err){
156 unmodified lines