-
Notifications
You must be signed in to change notification settings - Fork 545
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fix incorrect x-amz-content-sha256 header (#1326)
* fix: fix incorrect x-amz-content-sha256 header * chore: codegen fixing incorrect x-amz-sha256 * test(client-lex-runtime-service): add functional test * test(client-mediastore-data): add functional test
- Loading branch information
1 parent
e75fe71
commit 68f9315
Showing
9 changed files
with
81 additions
and
10 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
clients/client-lex-runtime-service/LexRuntimeService.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/// <reference types="mocha" /> | ||
import { expect } from "chai"; | ||
import { LexRuntimeService } from "./LexRuntimeService"; | ||
import { SerializeMiddleware } from "@aws-sdk/types"; | ||
import { HttpRequest } from "@aws-sdk/protocol-http"; | ||
|
||
describe("@aws-sdk/client-lex-runtime-service", () => { | ||
describe("PostContent", () => { | ||
it("should contain correct x-amz-content-sha256 header", async () => { | ||
const validator: SerializeMiddleware<any, any> = next => args => { | ||
// middleware intercept the request and return it early | ||
const request = args.request as HttpRequest; | ||
expect(request.headers).to.have.property( | ||
"x-amz-content-sha256", | ||
"UNSIGNED-PAYLOAD" | ||
); | ||
return Promise.resolve({ output: {} as any, response: {} as any }); | ||
}; | ||
const client = new LexRuntimeService({}); | ||
client.middlewareStack.add(validator, { | ||
step: "serialize", | ||
name: "endpointValidator", | ||
priority: "low" | ||
}); | ||
return await client.postContent({ | ||
botAlias: "alias", | ||
botName: "bot", | ||
userId: "user", | ||
contentType: "text/plain; charset=utf-8", | ||
inputStream: "hello world!" | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/// <reference types="mocha" /> | ||
import { expect } from "chai"; | ||
import { MediaStoreData } from "./MediaStoreData"; | ||
import { SerializeMiddleware } from "@aws-sdk/types"; | ||
import { HttpRequest } from "@aws-sdk/protocol-http"; | ||
|
||
describe("@aws-sdk/client-mediastore-data", () => { | ||
describe("PutObject", () => { | ||
it("should contain correct x-amz-content-sha256 header", async () => { | ||
const validator: SerializeMiddleware<any, any> = next => args => { | ||
// middleware intercept the request and return it early | ||
const request = args.request as HttpRequest; | ||
expect(request.headers).to.have.property( | ||
"x-amz-content-sha256", | ||
"UNSIGNED-PAYLOAD" | ||
); | ||
return Promise.resolve({ output: {} as any, response: {} as any }); | ||
}; | ||
const client = new MediaStoreData({}); | ||
client.middlewareStack.add(validator, { | ||
step: "serialize", | ||
name: "endpointValidator", | ||
priority: "low" | ||
}); | ||
return await client.putObject({ | ||
Path: "foo.avi", | ||
Body: "binary body" | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters