Skip to content

Commit

Permalink
fix(logger): disable logging of raw HTTP request/response (#1682)
Browse files Browse the repository at this point in the history
  • Loading branch information
trivikr authored Nov 13, 2020
1 parent 0964faf commit 2f1975d
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 32 deletions.
10 changes: 0 additions & 10 deletions packages/middleware-serde/src/deserializerMiddleware.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,4 @@ describe("deserializerMiddleware", () => {
expect(logger.info).toHaveBeenCalledTimes(1);
expect(logger.info).toHaveBeenCalledWith({ output: outputWithoutMetadata });
});

it("logs response if context.logger has debug function", async () => {
const logger = ({ debug: jest.fn() } as unknown) as Logger;

const response = await deserializerMiddleware(mockOptions, mockDeserializer)(mockNext, { logger })(mockArgs);

expect(response).toStrictEqual(mockResponse);
expect(logger.debug).toHaveBeenCalledTimes(1);
expect(logger.debug).toHaveBeenCalledWith({ httpResponse: mockNextResponse.response });
});
});
6 changes: 0 additions & 6 deletions packages/middleware-serde/src/deserializerMiddleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@ export const deserializerMiddleware = <Input extends object, Output extends obje

const { response } = await next(args);

if (typeof logger?.debug === "function") {
logger.debug({
httpResponse: response,
});
}

const parsed = await deserializer(response, options);

// Log parsed after $metadata is removed in https://github.com/aws/aws-sdk-js-v3/issues/1490
Expand Down
10 changes: 0 additions & 10 deletions packages/middleware-serde/src/serializerMiddleware.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,4 @@ describe("serializerMiddleware", () => {
expect(logger.info).toHaveBeenCalledTimes(1);
expect(logger.info).toHaveBeenCalledWith({ input: mockArgs.input });
});

it("logs request if context.logger has debug function", async () => {
const logger = ({ debug: jest.fn() } as unknown) as Logger;

const response = await serializerMiddleware(mockOptions, mockSerializer)(mockNext, { logger })(mockArgs);

expect(response).toStrictEqual(mockReturn);
expect(logger.debug).toHaveBeenCalledTimes(1);
expect(logger.debug).toHaveBeenCalledWith({ httpRequest: mockRequest });
});
});
6 changes: 0 additions & 6 deletions packages/middleware-serde/src/serializerMiddleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@ export const serializerMiddleware = <Input extends object, Output extends object

const request = await serializer(args.input, options);

if (typeof logger?.debug === "function") {
logger.debug({
httpRequest: request,
});
}

return next({
...args,
request,
Expand Down

0 comments on commit 2f1975d

Please sign in to comment.