From 294948e9442b31f073c9b697f1d2be9f1e8b7728 Mon Sep 17 00:00:00 2001 From: Allan Zheng Date: Thu, 23 Apr 2020 12:47:52 -0700 Subject: [PATCH] fix: not to override path and query from serializer --- .../codegen/integration/HttpBindingProtocolGenerator.java | 3 ++- .../codegen/integration/HttpRpcProtocolGenerator.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/integration/HttpBindingProtocolGenerator.java b/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/integration/HttpBindingProtocolGenerator.java index 8bb617172e2..740fad28681 100644 --- a/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/integration/HttpBindingProtocolGenerator.java +++ b/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/integration/HttpBindingProtocolGenerator.java @@ -227,6 +227,7 @@ private void generateOperationSerializer( HttpProtocolGeneratorUtils.writeHostPrefix(context, operation); } + writer.write("const endpoint = {...context.endpoint, path: undefined, query: undefined};"); writer.openBlock("return new $T({", "});", requestType, () -> { if (hasHostPrefix) { writer.write("hostname: resolvedHostname,"); @@ -247,7 +248,7 @@ private void generateOperationSerializer( } // Always set the body, writer.write("body: body,"); - writer.write("...context.endpoint,"); + writer.write("...endpoint,"); }); }); diff --git a/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/integration/HttpRpcProtocolGenerator.java b/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/integration/HttpRpcProtocolGenerator.java index 8ff75bc339a..3514347e011 100644 --- a/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/integration/HttpRpcProtocolGenerator.java +++ b/smithy-typescript-codegen/src/main/java/software/amazon/smithy/typescript/codegen/integration/HttpRpcProtocolGenerator.java @@ -107,12 +107,13 @@ public void generateSharedComponents(GenerationContext context) { + " resolvedHostname: string | undefined,\n" + " body: any,\n" + "): $T => {", "};", requestType, () -> { + writer.write("const endpoint = {...context.endpoint, path: undefined, query: undefined};"); writer.openBlock("const contents: any = {", "};", () -> { writer.write("protocol: \"https\","); writer.write("method: \"POST\","); writer.write("path: path,"); writer.write("headers: headers,"); - writer.write("...context.endpoint,"); + writer.write("...endpoint,"); }); writer.openBlock("if (resolvedHostname !== undefined) {", "}", () -> { writer.write("contents.hostname = resolvedHostname;");