Skip to content
Myr

Request#stream() fixes

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

a) on "end" the stream is already destroyed b) AFAIK its not destroyed on "error", so now we destroy it c) no need to callback(err) unless first

authored by visionmedia · committed by visionmedia · parent b5d6f1a · Browse files · 1 file+3 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+3 added−5 removed

  • other:+3 added−5 removed

1 file+3 added−5 removed

modified:lib/express/request.js+3 added-5 removed
217 unmodified lines
218 stream219 .addListener('error', function(err){220 if (first)221 return self.error(err, callback)222 stream.destroy()223 self.response.end()223 if (callback !== undefined) callback(err)224 })225 .addListener('data', function(data){226 if (first) {227 first = false
6 unmodified lines
234 })235 .addListener('end', function(){236 self.trigger('response', function(err){237 if (err)238 stream.destroy(),239 self.error(err, callback)240 else241 self.response.end()238 return self.error(err, callback)239 self.response.end()240 }, true)241 })242 },243
164 unmodified lines