File tree 1 file changed +9
-5
lines changed
packages/middleware-expect-continue/src
1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change 1
- import { HttpRequest } from "@smithy/protocol-http" ;
1
+ import { HttpHandler , HttpRequest } from "@smithy/protocol-http" ;
2
2
import {
3
3
BuildHandler ,
4
4
BuildHandlerArguments ,
@@ -7,21 +7,25 @@ import {
7
7
BuildMiddleware ,
8
8
MetadataBearer ,
9
9
Pluggable ,
10
+ RequestHandler ,
10
11
} from "@smithy/types" ;
11
12
12
13
interface PreviouslyResolved {
13
14
runtime : string ;
15
+ requestHandler ?: RequestHandler < any , any , any > | HttpHandler < any > ;
14
16
}
15
17
16
18
export function addExpectContinueMiddleware ( options : PreviouslyResolved ) : BuildMiddleware < any , any > {
17
19
return < Output extends MetadataBearer > ( next : BuildHandler < any , Output > ) : BuildHandler < any , Output > =>
18
20
async ( args : BuildHandlerArguments < any > ) : Promise < BuildHandlerOutput < Output > > => {
19
21
const { request } = args ;
20
22
if ( HttpRequest . isInstance ( request ) && request . body && options . runtime === "node" ) {
21
- request . headers = {
22
- ...request . headers ,
23
- Expect : "100-continue" ,
24
- } ;
23
+ if ( options . requestHandler ?. constructor ?. name !== "FetchHttpHandler" ) {
24
+ request . headers = {
25
+ ...request . headers ,
26
+ Expect : "100-continue" ,
27
+ } ;
28
+ }
25
29
}
26
30
return next ( {
27
31
...args ,
You can’t perform that action at this time.
0 commit comments