diff --git a/packages/fetch-hooks/__tests__/compose.ts b/packages/fetch-hooks/__tests__/compose.ts index f9aa717..31e3b24 100644 --- a/packages/fetch-hooks/__tests__/compose.ts +++ b/packages/fetch-hooks/__tests__/compose.ts @@ -6,7 +6,6 @@ import { appendHeader } from '../src/request'; test("compose", async () => { const fakeFetch = fetchMock.sandbox(); - global.Request = fakeFetch.config.Request as any; const testHeader = "X-Test"; @@ -29,7 +28,7 @@ test("compose", async () => { expect(response.ok).toBe(true); expect(await response.json()).toEqual({ - test: "1,2,3" + test: "1, 2, 3" }) }) diff --git a/packages/fetch-hooks/__tests__/hook.ts b/packages/fetch-hooks/__tests__/hook.ts index faf0e7c..679f757 100644 --- a/packages/fetch-hooks/__tests__/hook.ts +++ b/packages/fetch-hooks/__tests__/hook.ts @@ -6,7 +6,6 @@ import { DuplicateInvocationError, FetchHookInvocationImpl } from '../src/hook/i describe("hook", () => { const fakeFetch = fetchMock.sandbox(); - global.Request = fakeFetch.config.Request as any; fakeFetch.post("http://localhost/length", async (_url, {headers, body}) => { const h = new Headers(headers) @@ -71,8 +70,9 @@ describe("hook", () => { "X-Loopback": "true" }, method: "POST", - body: request.body - }) + body: request.body, + duplex: "half" // This is required when a stream is sent, but it is not part of the types yet + } as unknown as RequestInit) return next(newRequest); }); diff --git a/packages/fetch-hooks/__tests__/request.ts b/packages/fetch-hooks/__tests__/request.ts index 6aaf767..e2f7195 100644 --- a/packages/fetch-hooks/__tests__/request.ts +++ b/packages/fetch-hooks/__tests__/request.ts @@ -5,7 +5,6 @@ import { setHeader } from '../src/request'; describe("setHeader", () => { const fakeFetch = fetchMock.sandbox(); - global.Request = fakeFetch.config.Request as any; const testHeader = "X-Test";