From 3f121a1ad44682e3eb7826f3584fd6832ce9ca95 Mon Sep 17 00:00:00 2001 From: Siddharth Srivastava <48153483+siddsriv@users.noreply.github.com> Date: Tue, 17 Oct 2023 15:49:00 -0400 Subject: [PATCH] test(middleware-host-header): add test for :authority header in integ test (#5374) --- .../src/middleware-host-header.integ.spec.ts | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/packages/middleware-host-header/src/middleware-host-header.integ.spec.ts b/packages/middleware-host-header/src/middleware-host-header.integ.spec.ts index 8d4e4ed04741e..25fbe5c3a00c7 100644 --- a/packages/middleware-host-header/src/middleware-host-header.integ.spec.ts +++ b/packages/middleware-host-header/src/middleware-host-header.integ.spec.ts @@ -20,5 +20,26 @@ describe("middleware-host-header", () => { expect.hasAssertions(); }); + + it("should set the authority header when using http2", async () => { + const client = new SageMaker({ region: "us-west-2" }); + + requireRequestsFrom(client).toMatch({ + hostname: "api.sagemaker.us-west-2.amazonaws.com", + headers: { + ":authority": "api.sagemaker.us-west-2.amazonaws.com", + }, + }); + + client.config.requestHandler.metadata = { + handlerProtocol: "h2", + }; + + await client.describeCompilationJob({ + CompilationJobName: "compile-something", + }); + + expect.hasAssertions(); + }); }); });