File tree 1 file changed +13
-1
lines changed
packages/node-http-handler/src 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ export async function writeRequestBody(
21
21
const expect = headers [ "Expect" ] || headers [ "expect" ] ;
22
22
23
23
let timeoutId = - 1 ;
24
+ let hasError = false ;
24
25
25
26
if ( expect === "100-continue" ) {
26
27
await Promise . race < void > ( [
@@ -32,11 +33,22 @@ export async function writeRequestBody(
32
33
clearTimeout ( timeoutId ) ;
33
34
resolve ( ) ;
34
35
} ) ;
36
+ httpRequest . on ( "error" , ( ) => {
37
+ hasError = true ;
38
+ clearTimeout ( timeoutId ) ;
39
+ // this handler does not reject with the error
40
+ // because there is already an error listener
41
+ // on the request in node-http-handler
42
+ // and node-http2-handler.
43
+ resolve ( ) ;
44
+ } ) ;
35
45
} ) ,
36
46
] ) ;
37
47
}
38
48
39
- writeBody ( httpRequest , request . body ) ;
49
+ if ( ! hasError ) {
50
+ writeBody ( httpRequest , request . body ) ;
51
+ }
40
52
}
41
53
42
54
function writeBody (
You can’t perform that action at this time.
0 commit comments