File tree Expand file tree Collapse file tree 1 file changed +19
-17
lines changed Expand file tree Collapse file tree 1 file changed +19
-17
lines changed Original file line number Diff line number Diff line change @@ -182,21 +182,6 @@ function onFinish (err, statusCode = 500) {
182
182
return
183
183
}
184
184
185
- if ( res [ kProxyReq ] ) {
186
- res [ kProxyReq ] . abort ( )
187
- res [ kProxyReq ] = null
188
- }
189
-
190
- if ( res [ kProxySocket ] ) {
191
- res [ kProxySocket ] . end ( )
192
- res [ kProxySocket ] = null
193
- }
194
-
195
- if ( res [ kProxyRes ] ) {
196
- res [ kProxyRes ] . destroy ( )
197
- res [ kProxyRes ] = null
198
- }
199
-
200
185
if ( err ) {
201
186
err . statusCode = statusCode || err . statusCode || 500
202
187
err . code = err . code || res . code
@@ -221,8 +206,25 @@ function onFinish (err, statusCode = 500) {
221
206
res . end ( )
222
207
}
223
208
224
- res [ kProxyCallback ] . call ( null , err , res [ kReq ] , res )
225
- res [ kProxyCallback ] = null
209
+ if ( res [ kProxyCallback ] ) {
210
+ res [ kProxyCallback ] . call ( null , err , res [ kReq ] , res )
211
+ res [ kProxyCallback ] = null
212
+ }
213
+
214
+ if ( res [ kProxyReq ] ) {
215
+ res [ kProxyReq ] . abort ( )
216
+ res [ kProxyReq ] = null
217
+ }
218
+
219
+ if ( res [ kProxySocket ] ) {
220
+ res [ kProxySocket ] . end ( )
221
+ res [ kProxySocket ] = null
222
+ }
223
+
224
+ if ( res [ kProxyRes ] ) {
225
+ res [ kProxyRes ] . destroy ( )
226
+ res [ kProxyRes ] = null
227
+ }
226
228
}
227
229
228
230
function onRequestTimeout ( ) {
You can’t perform that action at this time.
0 commit comments