From 1fa98e19992c660e53e9ec97528ae9c081645e8c Mon Sep 17 00:00:00 2001 From: Trivikram Kamat <16024985+trivikr@users.noreply.github.com> Date: Mon, 21 Dec 2020 20:21:44 +0000 Subject: [PATCH 1/2] fix: log requestId, extendedRequestId, cfId in $metadata --- .../codegen/integration/HttpProtocolGeneratorUtils.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/integration/HttpProtocolGeneratorUtils.java b/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/integration/HttpProtocolGeneratorUtils.java index b5ecb701734..4f25adc5ffa 100644 --- a/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/integration/HttpProtocolGeneratorUtils.java +++ b/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/integration/HttpProtocolGeneratorUtils.java @@ -188,7 +188,9 @@ static void generateMetadataDeserializer(GenerationContext context, SymbolRefere writer.openBlock("const deserializeMetadata = (output: $T): __ResponseMetadata => ({", "});", responseType, () -> { writer.write("httpStatusCode: output.statusCode,"); - writer.write("requestId: output.headers[\"x-amzn-requestid\"]"); + writer.write("requestId: output.headers[\"x-amzn-requestid\"] ?? output.headers[\"x-amzn-request-id\"],"); + writer.write("extendedRequestId: output.headers[\"x-amz-id-2\"],"); + writer.write("cfId: output.headers[\"x-amz-cf-id\"],"); }); writer.write(""); } From 15f862de88a406298438cf93906ab0af0b324fbf Mon Sep 17 00:00:00 2001 From: Trivikram Kamat <16024985+trivikr@users.noreply.github.com> Date: Mon, 21 Dec 2020 20:25:11 +0000 Subject: [PATCH 2/2] fix: checkstyle errors --- .../codegen/integration/HttpProtocolGeneratorUtils.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/integration/HttpProtocolGeneratorUtils.java b/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/integration/HttpProtocolGeneratorUtils.java index 4f25adc5ffa..17f87b6b2c5 100644 --- a/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/integration/HttpProtocolGeneratorUtils.java +++ b/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/integration/HttpProtocolGeneratorUtils.java @@ -188,7 +188,8 @@ static void generateMetadataDeserializer(GenerationContext context, SymbolRefere writer.openBlock("const deserializeMetadata = (output: $T): __ResponseMetadata => ({", "});", responseType, () -> { writer.write("httpStatusCode: output.statusCode,"); - writer.write("requestId: output.headers[\"x-amzn-requestid\"] ?? output.headers[\"x-amzn-request-id\"],"); + writer.write("requestId: output.headers[\"x-amzn-requestid\"] ??" + + " output.headers[\"x-amzn-request-id\"],"); writer.write("extendedRequestId: output.headers[\"x-amz-id-2\"],"); writer.write("cfId: output.headers[\"x-amz-cf-id\"],"); });