Skip to content

Commit d915a19

Browse files
committed
formatting
1 parent 09a34e5 commit d915a19

File tree

4 files changed

+21
-7
lines changed

4 files changed

+21
-7
lines changed

.changeset/sweet-lions-design.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
"@smithy/fetch-http-handler": minor
3+
"@smithy/node-http-handler": minor
4+
"@smithy/util-stream": minor
5+
"@smithy/types": minor
6+
---
7+
8+
vitest compatibility

packages/fetch-http-handler/src/fetch-http-handler.browser.spec.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ vi.mock("./create-request", async () => {
1212
};
1313
});
1414

15-
describe(FetchHttpHandler.name, () => {
15+
(typeof Blob === "function" ? describe : describe.skip)(FetchHttpHandler.name, () => {
1616
interface MockHttpRequestOptions {
1717
method?: string;
1818
body?: any;
@@ -92,9 +92,11 @@ describe(FetchHttpHandler.name, () => {
9292
const username = "foo";
9393
const password = "bar";
9494
const mockHttpRequest = getMockHttpRequest({ username, password });
95-
await fetchHttpHandler.handle(mockHttpRequest).catch(error => {
96-
expect(String(error)).toContain("TypeError: Request cannot be constructed from a URL that includes credentials");
97-
})
95+
await fetchHttpHandler.handle(mockHttpRequest).catch((error) => {
96+
expect(String(error)).toContain(
97+
"TypeError: Request cannot be constructed from a URL that includes credentials"
98+
);
99+
});
98100

99101
const mockAuth = `${mockHttpRequest.username}:${mockHttpRequest.password}`;
100102
const expectedUrl = `${mockHttpRequest.protocol}//${mockAuth}@${mockHttpRequest.hostname}/`;

packages/fetch-http-handler/src/fetch-http-handler.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ let timeoutSpy: any;
1212
(global as any).Headers = vi.fn();
1313
const globalFetch = global.fetch;
1414

15-
describe(FetchHttpHandler.name, () => {
15+
(typeof Blob === "function" ? describe : describe.skip)(FetchHttpHandler.name, () => {
1616
beforeEach(() => {
1717
(global as any).AbortController = void 0;
1818
vi.clearAllMocks();

packages/node-http-handler/src/server.mock.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,19 @@ const setResponseBody = (response: ServerResponse, body: string | NodeJsRuntimeB
2727
export const createResponseFunction =
2828
(httpResp: HttpResponse) => (request: IncomingMessage, response: ServerResponse) => {
2929
response.statusCode = httpResp.statusCode;
30-
response.statusMessage = httpResp.reason;
30+
if (httpResp.reason) {
31+
response.statusMessage = httpResp.reason;
32+
}
3133
setResponseHeaders(response, httpResp.headers);
3234
setResponseBody(response, httpResp.body);
3335
};
3436

3537
export const createResponseFunctionWithDelay =
3638
(httpResp: HttpResponse, delay: number) => (request: IncomingMessage, response: ServerResponse) => {
3739
response.statusCode = httpResp.statusCode;
38-
response.statusMessage = httpResp.reason;
40+
if (httpResp.reason) {
41+
response.statusMessage = httpResp.reason;
42+
}
3943
setResponseHeaders(response, httpResp.headers);
4044
timing.setTimeout(() => setResponseBody(response, httpResp.body), delay);
4145
};

0 commit comments

Comments
 (0)