Skip to content

Commit

Permalink
fix(middleware-sdk-sqs): update requestHandler implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Yuan committed Sep 8, 2023
1 parent 1e6ea91 commit e958bfd
Showing 1 changed file with 31 additions and 7 deletions.
38 changes: 31 additions & 7 deletions packages/middleware-sdk-sqs/src/middleware-sdk-sqs.integ.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SQS } from "@aws-sdk/client-sqs";
import { HttpResponse } from "@smithy/protocol-http";
import { HttpHandler, HttpResponse } from "@smithy/protocol-http";
import crypto from "crypto";
import { Readable } from "stream";

Expand Down Expand Up @@ -112,11 +112,15 @@ describe("middleware-sdk-sqs", () => {
it("runs md5 checksums on received messages", async () => {
const client = new SQS({
region: "us-west-2",
requestHandler: new (class {
requestHandler: new (class implements HttpHandler {
async handle(): Promise<any> {
const r = responses();
return handlerResponse((useAwsQuery ? r.XML : r.JSON).receive);
}
updateHttpClientConfig(key: never, value: never): void {}
httpHandlerConfigs() {
return {};
}
})(),
});

Expand All @@ -130,11 +134,15 @@ describe("middleware-sdk-sqs", () => {
it("runs md5 checksums on sent messages", async () => {
const client = new SQS({
region: "us-west-2",
requestHandler: new (class {
requestHandler: new (class implements HttpHandler {
async handle(): Promise<any> {
const r = responses();
return handlerResponse((useAwsQuery ? r.XML : r.JSON).send);
}
updateHttpClientConfig(key: never, value: never): void {}
httpHandlerConfigs() {
return {};
}
})(),
});

Expand All @@ -149,11 +157,15 @@ describe("middleware-sdk-sqs", () => {
it("runs md5 checksums on batch sent messages", async () => {
const client = new SQS({
region: "us-west-2",
requestHandler: new (class {
requestHandler: new (class implements HttpHandler {
async handle(): Promise<any> {
const r = responses();
return handlerResponse((useAwsQuery ? r.XML : r.JSON).sendBatch);
}
updateHttpClientConfig(key: never, value: never): void {}
httpHandlerConfigs() {
return {};
}
})(),
});

Expand Down Expand Up @@ -187,11 +199,15 @@ describe("middleware-sdk-sqs", () => {
it("runs md5 checksums on received messages", async () => {
const client = new SQS({
region: "us-west-2",
requestHandler: new (class {
requestHandler: new (class implements HttpHandler {
async handle(): Promise<any> {
const r = responses();
return handlerResponse((useAwsQuery ? r.XML : r.JSON).receive);
}
updateHttpClientConfig(key: never, value: never): void {}
httpHandlerConfigs() {
return {};
}
})(),
});

Expand All @@ -208,11 +224,15 @@ describe("middleware-sdk-sqs", () => {

it("runs md5 checksums on sent messages", async () => {
const client = new SQS({
requestHandler: new (class {
requestHandler: new (class implements HttpHandler {
async handle(): Promise<any> {
const r = responses();
return handlerResponse((useAwsQuery ? r.XML : r.JSON).send);
}
updateHttpClientConfig(key: never, value: never): void {}
httpHandlerConfigs() {
return {};
}
})(),
});

Expand All @@ -231,11 +251,15 @@ describe("middleware-sdk-sqs", () => {
it("runs md5 checksums on batch sent messages", async () => {
const client = new SQS({
region: "us-west-2",
requestHandler: new (class {
requestHandler: new (class implements HttpHandler {
async handle(): Promise<any> {
const r = responses();
return handlerResponse((useAwsQuery ? r.XML : r.JSON).sendBatch);
}
updateHttpClientConfig(key: never, value: never): void {}
httpHandlerConfigs() {
return {};
}
})(),
});

Expand Down

0 comments on commit e958bfd

Please sign in to comment.