File tree Expand file tree Collapse file tree 3 files changed +5
-6
lines changed Expand file tree Collapse file tree 3 files changed +5
-6
lines changed Original file line number Diff line number Diff line change 19
19
},
20
20
"devDependencies" : {
21
21
"@types/jest" : " ^24.0.12" ,
22
+ "@aws-sdk/protocol-http" : " ^0.1.0-preview.1" ,
22
23
"jest" : " ^24.7.1" ,
23
24
"typescript" : " ~3.4.0"
24
25
},
Original file line number Diff line number Diff line change 1
1
import { extractMetadata } from "./" ;
2
- import { HttpResponse } from "@aws-sdk/types " ;
2
+ import { HttpResponse } from "@aws-sdk/protocol-http " ;
3
3
4
4
describe ( "extractMetadata" , ( ) => {
5
- const response : HttpResponse < string > = {
5
+ const response = new HttpResponse ( {
6
6
statusCode : 200 ,
7
7
headers : {
8
8
Foo : "bar" ,
9
9
Fizz : "buzz" ,
10
10
Snap : "crackle, pop"
11
11
} ,
12
12
body : "this is body"
13
- } ;
13
+ } ) ;
14
14
15
15
it ( "should extract the status code from responses" , ( ) => {
16
16
expect ( extractMetadata ( response ) . httpStatusCode ) . toBe ( response . statusCode ) ;
Original file line number Diff line number Diff line change @@ -5,9 +5,7 @@ const REQUEST_ID_ALT_HEADER = "x-amzn-requestid";
5
5
const EXTENDED_REQUEST_ID_HEADER = "x-amz-id-2" ;
6
6
const CF_ID_HEADER = "x-amz-cf-id" ;
7
7
8
- export function extractMetadata (
9
- httpResponse : HttpResponse < any >
10
- ) : ResponseMetadata {
8
+ export function extractMetadata ( httpResponse : HttpResponse ) : ResponseMetadata {
11
9
const httpHeaders : HeaderBag = Object . keys ( httpResponse . headers ) . reduce (
12
10
( lowercase : HeaderBag , headerName : string ) => {
13
11
lowercase [ headerName . toLowerCase ( ) ] = httpResponse . headers [ headerName ] ;
You can’t perform that action at this time.
0 commit comments