From 74c1ba48ef9419df60726d549d3f1417737e65d8 Mon Sep 17 00:00:00 2001 From: Trivikram Kamat <16024985+trivikr@users.noreply.github.com> Date: Wed, 23 Dec 2020 09:57:20 -0800 Subject: [PATCH] fix: log requestId, extendedRequestId, cfId in $metadata (#252) --- .../codegen/integration/HttpProtocolGeneratorUtils.java | 5 ++++- 1 file changed, 4 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..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,10 @@ 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(""); }