File tree Expand file tree Collapse file tree 2 files changed +3
-31
lines changed
packages/middleware-logger/src Expand file tree Collapse file tree 2 files changed +3
-31
lines changed Original file line number Diff line number Diff line change @@ -110,16 +110,7 @@ describe("loggerMiddleware", () => {
110
110
commandName,
111
111
input : mockInputLog ,
112
112
output : mockOutputLog ,
113
- metadata : {
114
- statusCode : mockResponse . response . statusCode ,
115
- requestId : mockResponse . response . headers [ "x-amzn-requestid" ] ,
116
- extendedRequestId : mockResponse . response . headers [ "x-amz-id-2" ] ,
117
- cfId : mockResponse . response . headers [ "x-amz-cf-id" ] ,
118
- retry : {
119
- attempts : $metadata . attempts ,
120
- totalDelay : $metadata . totalRetryDelay ,
121
- } ,
122
- } ,
113
+ metadata : $metadata ,
123
114
} ) ;
124
115
} ) ;
125
116
@@ -154,16 +145,7 @@ describe("loggerMiddleware", () => {
154
145
expect ( logger . info ) . toHaveBeenCalledWith ( {
155
146
input : mockArgs . input ,
156
147
output : outputWithoutMetadata ,
157
- metadata : {
158
- statusCode : customResponse . response . statusCode ,
159
- requestId : requestIdBackup ,
160
- extendedRequestId : undefined ,
161
- cfId : undefined ,
162
- retry : {
163
- attempts : $metadata . attempts ,
164
- totalDelay : $metadata . totalRetryDelay ,
165
- } ,
166
- } ,
148
+ metadata : $metadata ,
167
149
} ) ;
168
150
} ) ;
169
151
} ) ;
Original file line number Diff line number Diff line change @@ -25,23 +25,13 @@ export const loggerMiddleware = () => <Output extends MetadataBearer = MetadataB
25
25
}
26
26
27
27
if ( typeof logger . info === "function" ) {
28
- const httpResponse = response . response as HttpResponse ;
29
28
const { $metadata, ...outputWithoutMetadata } = response . output ;
30
29
logger . info ( {
31
30
clientName,
32
31
commandName,
33
32
input : inputFilterSensitiveLog ( args . input ) ,
34
33
output : outputFilterSensitiveLog ( outputWithoutMetadata ) ,
35
- metadata : {
36
- statusCode : httpResponse . statusCode ,
37
- requestId : httpResponse . headers [ "x-amzn-requestid" ] ?? httpResponse . headers [ "x-amzn-request-id" ] ,
38
- extendedRequestId : httpResponse . headers [ "x-amz-id-2" ] ,
39
- cfId : httpResponse . headers [ "x-amz-cf-id" ] ,
40
- retry : {
41
- attempts : $metadata . attempts ,
42
- totalDelay : $metadata . totalRetryDelay ,
43
- } ,
44
- } ,
34
+ metadata : $metadata ,
45
35
} ) ;
46
36
}
47
37
You can’t perform that action at this time.
0 commit comments