File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 1919 "dependencies" : {
2020 "@aws-sdk/aws-protocoltests-json" : " *" ,
2121 "@smithy/protocol-http" : " ^4.1.4" ,
22+ "@smithy/signature-v4" : " ^4.2.0" ,
2223 "@smithy/types" : " ^3.5.0" ,
2324 "tslib" : " ^2.6.2"
2425 },
Original file line number Diff line number Diff line change 11import { HttpHandler , HttpRequest , HttpResponse } from "@smithy/protocol-http" ;
2+ import type { SignatureV4 } from "@smithy/signature-v4" ;
23import {
4+ AwsCredentialIdentity ,
35 Client ,
46 HandlerExecutionContext ,
57 HttpHandlerOptions ,
8+ IdentityProvider ,
69 RequestHandler ,
710 RequestHandlerOutput ,
11+ SelectedHttpAuthScheme ,
812 SMITHY_CONTEXT_KEY ,
913} from "@smithy/types" ;
1014import { expect } from "vitest" ;
@@ -118,8 +122,13 @@ export class TestHttpHandler implements HttpHandler {
118122 }
119123 client . middlewareStack . addRelativeTo (
120124 ( next : any , context : HandlerExecutionContext ) => ( args : any ) => {
121- if ( context [ SMITHY_CONTEXT_KEY ] ?. selectedHttpAuthScheme ) {
122- ( context [ SMITHY_CONTEXT_KEY ] as any ) . selectedHttpAuthScheme . identity = MOCK_CREDENTIALS ;
125+ const scheme = context [ SMITHY_CONTEXT_KEY ] ?. selectedHttpAuthScheme as SelectedHttpAuthScheme ;
126+ if ( scheme ) {
127+ scheme . identity = MOCK_CREDENTIALS as AwsCredentialIdentity ;
128+ if ( ( scheme . signer as any ) . credentialProvider ) {
129+ ( scheme . signer as any ) . credentialProvider = ( async ( ) =>
130+ MOCK_CREDENTIALS ) as IdentityProvider < AwsCredentialIdentity > ;
131+ }
123132 }
124133 return next ( args ) ;
125134 } ,
You can’t perform that action at this time.
0 commit comments