From f61d0535d4dc87ad66050b39954ba9d85e524852 Mon Sep 17 00:00:00 2001 From: Artem Zakharchenko Date: Mon, 20 Feb 2023 02:26:40 +0100 Subject: [PATCH] chore(wip): try undici --- package.json | 4 +- src/RemoteHttpInterceptor.ts | 4 +- .../ClientRequest/NodeClientRequest.test.ts | 2 +- src/interceptors/ClientRequest/index.test.ts | 2 +- .../ClientRequest/utils/createRequest.ts | 2 +- .../ClientRequest/utils/createResponse.ts | 2 +- .../XMLHttpRequestController.ts | 2 +- .../XMLHttpRequest/utils/createResponse.ts | 2 +- src/interceptors/fetch/index.ts | 2 +- src/utils/toInteractiveRequest.ts | 6 +- test/features/events/response.test.ts | 2 +- test/features/remote/remote.test.ts | 2 +- test/helpers.ts | 2 +- .../compliance/xhr-add-event-listener.test.ts | 2 +- .../compliance/xhr-events-order.test.ts | 2 +- .../xhr-response-body-empty.test.ts | 2 +- .../xhr-response-body-json-invalid.test.ts | 2 +- .../compliance/xhr-response-body-xml.test.ts | 2 +- .../compliance/xhr-response-headers.test.ts | 2 +- .../compliance/xhr-response-type.test.ts | 2 +- .../compliance/xhr-status.test.ts | 2 +- .../XMLHttpRequest/features/events.test.ts | 2 +- .../XMLHttpRequest/response/xhr.test.ts | 2 +- test/modules/fetch/response/fetch.test.ts | 2 +- .../http/compliance/http-rate-limit.test.ts | 2 +- .../http/compliance/http-req-callback.test.ts | 2 +- .../compliance/http-res-set-encoding.test.ts | 2 +- test/modules/http/http-performance.test.ts | 2 +- ...ncurrent-different-response-source.test.ts | 2 +- .../http-concurrent-same-host.test.ts | 2 +- .../http/regressions/http-socket-timeout.ts | 2 +- test/modules/http/response/http-https.test.ts | 2 +- .../response/http-response-patching.test.ts | 2 +- test/third-party/axios.test.ts | 2 +- test/third-party/got.test.ts | 2 +- yarn.lock | 88 +++++-------------- 36 files changed, 60 insertions(+), 106 deletions(-) diff --git a/package.json b/package.json index 8671fe8a..1bb1d558 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,6 @@ "@commitlint/config-conventional": "^16.0.0", "@open-draft/test-server": "^0.4.2", "@ossjs/release": "^0.4.0", - "@remix-run/web-fetch": "^4.3.1", "@types/cors": "^2.8.12", "@types/express": "^4.17.13", "@types/express-rate-limit": "^6.0.0", @@ -112,6 +111,7 @@ "ts-jest": "^27.1.1", "tsup": "^6.5.0", "typescript": "^4.9.4", + "undici": "^5.20.0", "wait-for-expect": "^3.0.2", "web-encoding": "^1.1.5" }, @@ -141,4 +141,4 @@ "path": "./node_modules/cz-conventional-changelog" } } -} \ No newline at end of file +} diff --git a/src/RemoteHttpInterceptor.ts b/src/RemoteHttpInterceptor.ts index def69273..20ccafec 100644 --- a/src/RemoteHttpInterceptor.ts +++ b/src/RemoteHttpInterceptor.ts @@ -1,6 +1,6 @@ import { ChildProcess } from 'child_process' -import { Request, Response } from '@remix-run/web-fetch' -import { Headers, HeadersObject, headersToObject } from 'headers-polyfill' +import { Request, Response, Headers } from 'undici' +import { HeadersObject, headersToObject } from 'headers-polyfill' import { HttpRequestEventMap } from './glossary' import { Interceptor } from './Interceptor' import { BatchInterceptor } from './BatchInterceptor' diff --git a/src/interceptors/ClientRequest/NodeClientRequest.test.ts b/src/interceptors/ClientRequest/NodeClientRequest.test.ts index ab252930..55c05c77 100644 --- a/src/interceptors/ClientRequest/NodeClientRequest.test.ts +++ b/src/interceptors/ClientRequest/NodeClientRequest.test.ts @@ -4,7 +4,7 @@ import { debug } from 'debug' import * as express from 'express' import { HttpServer } from '@open-draft/test-server/http' -import { Response } from '@remix-run/web-fetch' +import { Response } from 'undici' import { NodeClientRequest } from './NodeClientRequest' import { getIncomingMessageBody } from './utils/getIncomingMessageBody' import { normalizeClientRequestArgs } from './utils/normalizeClientRequestArgs' diff --git a/src/interceptors/ClientRequest/index.test.ts b/src/interceptors/ClientRequest/index.test.ts index 11aa3309..338f3969 100644 --- a/src/interceptors/ClientRequest/index.test.ts +++ b/src/interceptors/ClientRequest/index.test.ts @@ -1,6 +1,6 @@ import * as http from 'http' import { HttpServer } from '@open-draft/test-server/http' -import { Response } from '@remix-run/web-fetch' +import { Response } from 'undici' import { ClientRequestInterceptor } from '.' const httpServer = new HttpServer((app) => { diff --git a/src/interceptors/ClientRequest/utils/createRequest.ts b/src/interceptors/ClientRequest/utils/createRequest.ts index 9c071cf6..8a6e9fd6 100644 --- a/src/interceptors/ClientRequest/utils/createRequest.ts +++ b/src/interceptors/ClientRequest/utils/createRequest.ts @@ -1,4 +1,4 @@ -import { Request } from '@remix-run/web-fetch' +import { Request } from 'undici' import { Headers } from 'headers-polyfill' import type { NodeClientRequest } from '../NodeClientRequest' diff --git a/src/interceptors/ClientRequest/utils/createResponse.ts b/src/interceptors/ClientRequest/utils/createResponse.ts index 0c55c5e5..024e2b89 100644 --- a/src/interceptors/ClientRequest/utils/createResponse.ts +++ b/src/interceptors/ClientRequest/utils/createResponse.ts @@ -1,5 +1,5 @@ import type { IncomingMessage } from 'http' -import { Response, ReadableStream } from '@remix-run/web-fetch' +import { Response, ReadableStream } from 'undici' import { objectToHeaders } from 'headers-polyfill' /** diff --git a/src/interceptors/XMLHttpRequest/XMLHttpRequestController.ts b/src/interceptors/XMLHttpRequest/XMLHttpRequestController.ts index 36691cac..3d82c3c0 100644 --- a/src/interceptors/XMLHttpRequest/XMLHttpRequestController.ts +++ b/src/interceptors/XMLHttpRequest/XMLHttpRequestController.ts @@ -1,5 +1,5 @@ import type { Debugger } from 'debug' -import { Headers, Request } from '@remix-run/web-fetch' +import { Headers, Request } from 'undici' import { headersToString } from 'headers-polyfill' import { concatArrayBuffer } from './utils/concatArrayBuffer' import { createEvent } from './utils/createEvent' diff --git a/src/interceptors/XMLHttpRequest/utils/createResponse.ts b/src/interceptors/XMLHttpRequest/utils/createResponse.ts index 00ee66a5..ffa21bfd 100644 --- a/src/interceptors/XMLHttpRequest/utils/createResponse.ts +++ b/src/interceptors/XMLHttpRequest/utils/createResponse.ts @@ -1,4 +1,4 @@ -import { Response } from '@remix-run/web-fetch' +import { Response } from 'undici' import { stringToHeaders } from 'headers-polyfill' export function createResponse( diff --git a/src/interceptors/fetch/index.ts b/src/interceptors/fetch/index.ts index cb8ff5e6..4bdead10 100644 --- a/src/interceptors/fetch/index.ts +++ b/src/interceptors/fetch/index.ts @@ -1,5 +1,5 @@ import { invariant } from 'outvariant' -import type { Response as ResponsePolyfill } from '@remix-run/web-fetch' +import type { Response as ResponsePolyfill } from 'undici' import { HttpRequestEventMap, IS_PATCHED_MODULE } from '../../glossary' import { Interceptor } from '../../Interceptor' import { uuidv4 } from '../../utils/uuid' diff --git a/src/utils/toInteractiveRequest.ts b/src/utils/toInteractiveRequest.ts index e5acad3c..a9f9b398 100644 --- a/src/utils/toInteractiveRequest.ts +++ b/src/utils/toInteractiveRequest.ts @@ -1,13 +1,15 @@ import { format } from 'outvariant' import { createLazyCallback, LazyCallback } from './createLazyCallback' -type LazyResponseCallback = (response: Response) => void +type LazyResponseCallback = (response: globalThis.Response) => void export type InteractiveRequest = globalThis.Request & { respondWith: LazyCallback } -export function toInteractiveRequest(request: Request): InteractiveRequest { +export function toInteractiveRequest( + request: globalThis.Request +): InteractiveRequest { Object.defineProperty(request, 'respondWith', { writable: false, enumerable: true, diff --git a/test/features/events/response.test.ts b/test/features/events/response.test.ts index 62b5b3bb..d3d6c593 100644 --- a/test/features/events/response.test.ts +++ b/test/features/events/response.test.ts @@ -4,7 +4,7 @@ import * as https from 'https' import fetch from 'node-fetch' import waitForExpect from 'wait-for-expect' -import { Response } from '@remix-run/web-fetch' +import { Response } from 'undici' import { HttpServer, httpsAgent } from '@open-draft/test-server/http' import { HttpRequestEventMap } from '../../../src' import { createXMLHttpRequest, waitForClientRequest } from '../../helpers' diff --git a/test/features/remote/remote.test.ts b/test/features/remote/remote.test.ts index 3a4b9cea..b45aa154 100644 --- a/test/features/remote/remote.test.ts +++ b/test/features/remote/remote.test.ts @@ -3,7 +3,7 @@ */ import * as path from 'path' import { spawn } from 'child_process' -import { Response } from '@remix-run/web-fetch' +import { Response } from 'undici' import { RemoteHttpResolver } from '../../../src/RemoteHttpInterceptor' const CHILD_PATH = path.resolve(__dirname, 'child.js') diff --git a/test/helpers.ts b/test/helpers.ts index 6df1df6c..79553ada 100644 --- a/test/helpers.ts +++ b/test/helpers.ts @@ -2,7 +2,7 @@ import https from 'https' import http, { ClientRequest, IncomingMessage, RequestOptions } from 'http' import nodeFetch, { Response, RequestInfo, RequestInit } from 'node-fetch' import { objectToHeaders } from 'headers-polyfill' -import { Request } from '@remix-run/web-fetch' +import { Request } from 'undici' import { Page, ScenarioApi } from 'page-with' import { getRequestOptionsByUrl } from '../src/utils/getRequestOptionsByUrl' import { getIncomingMessageBody } from '../src/interceptors/ClientRequest/utils/getIncomingMessageBody' diff --git a/test/modules/XMLHttpRequest/compliance/xhr-add-event-listener.test.ts b/test/modules/XMLHttpRequest/compliance/xhr-add-event-listener.test.ts index da11cac5..e0ea4674 100644 --- a/test/modules/XMLHttpRequest/compliance/xhr-add-event-listener.test.ts +++ b/test/modules/XMLHttpRequest/compliance/xhr-add-event-listener.test.ts @@ -2,7 +2,7 @@ * @jest-environment jsdom * @see https://github.com/mswjs/msw/issues/273 */ -import { Response } from '@remix-run/web-fetch' +import { Response } from 'undici' import { XMLHttpRequestInterceptor } from '../../../../src/interceptors/XMLHttpRequest' import { createXMLHttpRequest } from '../../../helpers' diff --git a/test/modules/XMLHttpRequest/compliance/xhr-events-order.test.ts b/test/modules/XMLHttpRequest/compliance/xhr-events-order.test.ts index c5f24e0b..d5b43fe8 100644 --- a/test/modules/XMLHttpRequest/compliance/xhr-events-order.test.ts +++ b/test/modules/XMLHttpRequest/compliance/xhr-events-order.test.ts @@ -3,7 +3,7 @@ * @see https://xhr.spec.whatwg.org/#events */ import { HttpServer } from '@open-draft/test-server/http' -import { Response } from '@remix-run/web-fetch' +import { Response } from 'undici' import { XMLHttpRequestInterceptor } from '../../../../src/interceptors/XMLHttpRequest' import { createXMLHttpRequest } from '../../../helpers' diff --git a/test/modules/XMLHttpRequest/compliance/xhr-response-body-empty.test.ts b/test/modules/XMLHttpRequest/compliance/xhr-response-body-empty.test.ts index fb341be3..bdf2ef87 100644 --- a/test/modules/XMLHttpRequest/compliance/xhr-response-body-empty.test.ts +++ b/test/modules/XMLHttpRequest/compliance/xhr-response-body-empty.test.ts @@ -1,7 +1,7 @@ /** * @jest-environment jsdom */ -import { Response } from '@remix-run/web-fetch' +import { Response } from 'undici' import { XMLHttpRequestInterceptor } from '../../../../src/interceptors/XMLHttpRequest' import { createXMLHttpRequest } from '../../../helpers' diff --git a/test/modules/XMLHttpRequest/compliance/xhr-response-body-json-invalid.test.ts b/test/modules/XMLHttpRequest/compliance/xhr-response-body-json-invalid.test.ts index 66de35e0..35c90e68 100644 --- a/test/modules/XMLHttpRequest/compliance/xhr-response-body-json-invalid.test.ts +++ b/test/modules/XMLHttpRequest/compliance/xhr-response-body-json-invalid.test.ts @@ -1,7 +1,7 @@ /** * @jest-environment jsdom */ -import { Response } from '@remix-run/web-fetch' +import { Response } from 'undici' import { XMLHttpRequestInterceptor } from '../../../../src/interceptors/XMLHttpRequest' import { createXMLHttpRequest } from '../../../helpers' diff --git a/test/modules/XMLHttpRequest/compliance/xhr-response-body-xml.test.ts b/test/modules/XMLHttpRequest/compliance/xhr-response-body-xml.test.ts index ce18ebb1..e253aad2 100644 --- a/test/modules/XMLHttpRequest/compliance/xhr-response-body-xml.test.ts +++ b/test/modules/XMLHttpRequest/compliance/xhr-response-body-xml.test.ts @@ -1,7 +1,7 @@ /** * @jest-environment jsdom */ -import { Response } from '@remix-run/web-fetch' +import { Response } from 'undici' import { XMLHttpRequestInterceptor } from '../../../../src/interceptors/XMLHttpRequest' import { createXMLHttpRequest } from '../../../helpers' diff --git a/test/modules/XMLHttpRequest/compliance/xhr-response-headers.test.ts b/test/modules/XMLHttpRequest/compliance/xhr-response-headers.test.ts index 41a02cfb..75338f20 100644 --- a/test/modules/XMLHttpRequest/compliance/xhr-response-headers.test.ts +++ b/test/modules/XMLHttpRequest/compliance/xhr-response-headers.test.ts @@ -2,7 +2,7 @@ * @jest-environment jsdom */ import { HttpServer } from '@open-draft/test-server/http' -import { Response } from '@remix-run/web-fetch' +import { Response } from 'undici' import { XMLHttpRequestInterceptor } from '../../../../src/interceptors/XMLHttpRequest' import { createXMLHttpRequest } from '../../../helpers' diff --git a/test/modules/XMLHttpRequest/compliance/xhr-response-type.test.ts b/test/modules/XMLHttpRequest/compliance/xhr-response-type.test.ts index ff5b384c..186fdb70 100644 --- a/test/modules/XMLHttpRequest/compliance/xhr-response-type.test.ts +++ b/test/modules/XMLHttpRequest/compliance/xhr-response-type.test.ts @@ -1,7 +1,7 @@ /** * @jest-environment jsdom */ -import { Response } from '@remix-run/web-fetch' +import { Response } from 'undici' import { encodeBuffer } from '../../../../src' import { XMLHttpRequestInterceptor } from '../../../../src/interceptors/XMLHttpRequest' import { toArrayBuffer } from '../../../../src/utils/bufferUtils' diff --git a/test/modules/XMLHttpRequest/compliance/xhr-status.test.ts b/test/modules/XMLHttpRequest/compliance/xhr-status.test.ts index c131a102..629090ad 100644 --- a/test/modules/XMLHttpRequest/compliance/xhr-status.test.ts +++ b/test/modules/XMLHttpRequest/compliance/xhr-status.test.ts @@ -2,7 +2,7 @@ * @jest-environment jsdom * @see https://github.com/mswjs/interceptors/issues/281 */ -import { Response } from '@remix-run/web-fetch' +import { Response } from 'undici' import { XMLHttpRequestInterceptor } from '../../../../src/interceptors/XMLHttpRequest' import { createXMLHttpRequest } from '../../../helpers' diff --git a/test/modules/XMLHttpRequest/features/events.test.ts b/test/modules/XMLHttpRequest/features/events.test.ts index af99be3a..64ca98e6 100644 --- a/test/modules/XMLHttpRequest/features/events.test.ts +++ b/test/modules/XMLHttpRequest/features/events.test.ts @@ -1,7 +1,7 @@ /** * @jest-environment jsdom */ -import { Response } from '@remix-run/web-fetch' +import { Response } from 'undici' import { HttpServer } from '@open-draft/test-server/http' import { XMLHttpRequestInterceptor } from '../../../../src/interceptors/XMLHttpRequest' import { createXMLHttpRequest } from '../../../helpers' diff --git a/test/modules/XMLHttpRequest/response/xhr.test.ts b/test/modules/XMLHttpRequest/response/xhr.test.ts index 27a8879d..46046b4a 100644 --- a/test/modules/XMLHttpRequest/response/xhr.test.ts +++ b/test/modules/XMLHttpRequest/response/xhr.test.ts @@ -2,7 +2,7 @@ * @jest-environment jsdom */ import { HttpServer } from '@open-draft/test-server/http' -import { Response } from '@remix-run/web-fetch' +import { Response } from 'undici' import { XMLHttpRequestInterceptor } from '../../../../src/interceptors/XMLHttpRequest' import { createXMLHttpRequest } from '../../../helpers' diff --git a/test/modules/fetch/response/fetch.test.ts b/test/modules/fetch/response/fetch.test.ts index 3cf44f1e..274ffcea 100644 --- a/test/modules/fetch/response/fetch.test.ts +++ b/test/modules/fetch/response/fetch.test.ts @@ -4,7 +4,7 @@ import fetch from 'node-fetch' import { HttpServer, httpsAgent } from '@open-draft/test-server/http' import { ClientRequestInterceptor } from '../../../../src/interceptors/ClientRequest' -import { Response } from '@remix-run/web-fetch' +import { Response } from 'undici' const httpServer = new HttpServer((app) => { app.get('/', (req, res) => { diff --git a/test/modules/http/compliance/http-rate-limit.test.ts b/test/modules/http/compliance/http-rate-limit.test.ts index 9a106129..18b590f8 100644 --- a/test/modules/http/compliance/http-rate-limit.test.ts +++ b/test/modules/http/compliance/http-rate-limit.test.ts @@ -1,7 +1,7 @@ import * as http from 'http' import rateLimit from 'express-rate-limit' import { HttpServer } from '@open-draft/test-server/http' -import { Response } from '@remix-run/web-fetch' +import { Response } from 'undici' import { ClientRequestInterceptor } from '../../../../src/interceptors/ClientRequest' const httpServer = new HttpServer((app) => { diff --git a/test/modules/http/compliance/http-req-callback.test.ts b/test/modules/http/compliance/http-req-callback.test.ts index ff71b274..edf9167f 100644 --- a/test/modules/http/compliance/http-req-callback.test.ts +++ b/test/modules/http/compliance/http-req-callback.test.ts @@ -4,7 +4,7 @@ import { IncomingMessage } from 'http' import * as https from 'https' import { HttpServer, httpsAgent } from '@open-draft/test-server/http' -import { Response } from '@remix-run/web-fetch' +import { Response } from 'undici' import { getRequestOptionsByUrl } from '../../../../src/utils/getRequestOptionsByUrl' import { ClientRequestInterceptor } from '../../../../src/interceptors/ClientRequest' diff --git a/test/modules/http/compliance/http-res-set-encoding.test.ts b/test/modules/http/compliance/http-res-set-encoding.test.ts index 4e2dbad3..a4d86b99 100644 --- a/test/modules/http/compliance/http-res-set-encoding.test.ts +++ b/test/modules/http/compliance/http-res-set-encoding.test.ts @@ -3,7 +3,7 @@ */ import * as http from 'http' import { HttpServer } from '@open-draft/test-server/http' -import { Response } from '@remix-run/web-fetch' +import { Response } from 'undici' import { ClientRequestInterceptor } from '../../../../src/interceptors/ClientRequest' const httpServer = new HttpServer((app) => { diff --git a/test/modules/http/http-performance.test.ts b/test/modules/http/http-performance.test.ts index 7b1acff3..abcb0f45 100644 --- a/test/modules/http/http-performance.test.ts +++ b/test/modules/http/http-performance.test.ts @@ -2,7 +2,7 @@ * @jest-environment node */ import { HttpServer } from '@open-draft/test-server/http' -import { Response } from '@remix-run/web-fetch' +import { Response } from 'undici' import { ClientRequestInterceptor } from '../../../src/interceptors/ClientRequest' import { httpGet, PromisifiedResponse } from '../../helpers' diff --git a/test/modules/http/regressions/http-concurrent-different-response-source.test.ts b/test/modules/http/regressions/http-concurrent-different-response-source.test.ts index 5c4a5161..bd468644 100644 --- a/test/modules/http/regressions/http-concurrent-different-response-source.test.ts +++ b/test/modules/http/regressions/http-concurrent-different-response-source.test.ts @@ -2,7 +2,7 @@ * @jest-environment node */ import { HttpServer } from '@open-draft/test-server/http' -import { Response } from '@remix-run/web-fetch' +import { Response } from 'undici' import { httpGet } from '../../../helpers' import { sleep } from '../../../../test/helpers' import { ClientRequestInterceptor } from '../../../../src/interceptors/ClientRequest' diff --git a/test/modules/http/regressions/http-concurrent-same-host.test.ts b/test/modules/http/regressions/http-concurrent-same-host.test.ts index 4498db81..abac0243 100644 --- a/test/modules/http/regressions/http-concurrent-same-host.test.ts +++ b/test/modules/http/regressions/http-concurrent-same-host.test.ts @@ -3,7 +3,7 @@ * @see https://github.com/mswjs/interceptors/issues/2 */ import * as http from 'http' -import { Response } from '@remix-run/web-fetch' +import { Response } from 'undici' import { ClientRequestInterceptor } from '../../../../src/interceptors/ClientRequest' let requests: Array = [] diff --git a/test/modules/http/regressions/http-socket-timeout.ts b/test/modules/http/regressions/http-socket-timeout.ts index 30158440..25874708 100644 --- a/test/modules/http/regressions/http-socket-timeout.ts +++ b/test/modules/http/regressions/http-socket-timeout.ts @@ -6,7 +6,7 @@ */ import * as http from 'http' import { HttpServer } from '@open-draft/test-server/http' -import { Response } from '@remix-run/web-fetch' +import { Response } from 'undici' import { ClientRequestInterceptor } from '../../../../src/interceptors/ClientRequest' jest.setTimeout(5000) diff --git a/test/modules/http/response/http-https.test.ts b/test/modules/http/response/http-https.test.ts index 2b222de9..e7984b65 100644 --- a/test/modules/http/response/http-https.test.ts +++ b/test/modules/http/response/http-https.test.ts @@ -3,7 +3,7 @@ */ import * as http from 'http' import * as https from 'https' -import { Response } from '@remix-run/web-fetch' +import { Response } from 'undici' import { HttpServer, httpsAgent } from '@open-draft/test-server/http' import { waitForClientRequest } from '../../../helpers' import { ClientRequestInterceptor } from '../../../../src/interceptors/ClientRequest' diff --git a/test/modules/http/response/http-response-patching.test.ts b/test/modules/http/response/http-response-patching.test.ts index 249c242b..2904b1f7 100644 --- a/test/modules/http/response/http-response-patching.test.ts +++ b/test/modules/http/response/http-response-patching.test.ts @@ -3,7 +3,7 @@ */ import * as http from 'http' import { HttpServer } from '@open-draft/test-server/http' -import { Response } from '@remix-run/web-fetch' +import { Response } from 'undici' import { BatchInterceptor } from '../../../../src' import { ClientRequestInterceptor } from '../../../../src/interceptors/ClientRequest' import { XMLHttpRequestInterceptor } from '../../../../src/interceptors/XMLHttpRequest' diff --git a/test/third-party/axios.test.ts b/test/third-party/axios.test.ts index ad3896b1..331ef502 100644 --- a/test/third-party/axios.test.ts +++ b/test/third-party/axios.test.ts @@ -4,7 +4,7 @@ import axios from 'axios' import { HttpServer } from '@open-draft/test-server/http' import { ClientRequestInterceptor } from '../../src/interceptors/ClientRequest' -import { Response } from '@remix-run/web-fetch' +import { Response } from 'undici' const httpServer = new HttpServer((app) => { app.get('/books', (req, res) => { diff --git a/test/third-party/got.test.ts b/test/third-party/got.test.ts index 99c8c971..1b23eb6c 100644 --- a/test/third-party/got.test.ts +++ b/test/third-party/got.test.ts @@ -4,7 +4,7 @@ import got from 'got' import { HttpServer } from '@open-draft/test-server/http' import { ClientRequestInterceptor } from '../../src/interceptors/ClientRequest' -import { Response } from '@remix-run/web-fetch' +import { Response } from 'undici' const httpServer = new HttpServer((app) => { app.get('/user', (req, res) => { diff --git a/yarn.lock b/yarn.lock index 49bde1fb..93508b8f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -939,41 +939,6 @@ semver "^7.3.7" yargs "^17.4.1" -"@remix-run/web-blob@^3.0.4": - version "3.0.4" - resolved "https://registry.yarnpkg.com/@remix-run/web-blob/-/web-blob-3.0.4.tgz#99c67b9d0fb641bd0c07d267fd218ae5aa4ae5ed" - integrity sha512-AfegzZvSSDc+LwnXV+SwROTrDtoLiPxeFW+jxgvtDAnkuCX1rrzmVJ6CzqZ1Ai0bVfmJadkG5GxtAfYclpPmgw== - dependencies: - "@remix-run/web-stream" "^1.0.0" - web-encoding "1.1.5" - -"@remix-run/web-fetch@^4.3.1": - version "4.3.2" - resolved "https://registry.yarnpkg.com/@remix-run/web-fetch/-/web-fetch-4.3.2.tgz#193758bb7a301535540f0e3a86c743283f81cf56" - integrity sha512-aRNaaa0Fhyegv/GkJ/qsxMhXvyWGjPNgCKrStCvAvV1XXphntZI0nQO/Fl02LIQg3cGL8lDiOXOS1gzqDOlG5w== - dependencies: - "@remix-run/web-blob" "^3.0.4" - "@remix-run/web-form-data" "^3.0.3" - "@remix-run/web-stream" "^1.0.3" - "@web3-storage/multipart-parser" "^1.0.0" - abort-controller "^3.0.0" - data-uri-to-buffer "^3.0.1" - mrmime "^1.0.0" - -"@remix-run/web-form-data@^3.0.3": - version "3.0.3" - resolved "https://registry.yarnpkg.com/@remix-run/web-form-data/-/web-form-data-3.0.3.tgz#f89a7f971aaf1084d2da87affbb7f4e01c32b8ce" - integrity sha512-wL4veBtVPazSpXfPMzrbmeV3IxuxCfcQYPerQ8BXRO5ahAEVw23tv7xS+yoX0XDO5j+vpRaSbhHJK1H5gF7eYQ== - dependencies: - web-encoding "1.1.5" - -"@remix-run/web-stream@^1.0.0", "@remix-run/web-stream@^1.0.3": - version "1.0.3" - resolved "https://registry.yarnpkg.com/@remix-run/web-stream/-/web-stream-1.0.3.tgz#3284a6a45675d1455c4d9c8f31b89225c9006438" - integrity sha512-wlezlJaA5NF6SsNMiwQnnAW6tnPzQ5I8qk0Y0pSohm0eHKa2FQ1QhEKLVVcDDu02TmkfHgnux0igNfeYhDOXiA== - dependencies: - web-streams-polyfill "^3.1.1" - "@sindresorhus/is@^4.0.0": version "4.0.0" resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-4.0.0.tgz#2ff674e9611b45b528896d820d3d7a812de2f0e4" @@ -1416,11 +1381,6 @@ dependencies: "@types/node" "*" -"@web3-storage/multipart-parser@^1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@web3-storage/multipart-parser/-/multipart-parser-1.0.0.tgz#6b69dc2a32a5b207ba43e556c25cc136a56659c4" - integrity sha512-BEO6al7BYqcnfX15W2cnGR+Q566ACXAT9UQykORCWW80lmkpWsnEob6zJS1ZVBKsSJC8+7vJkHwlp+lXG1UCdw== - "@webassemblyjs/ast@1.11.1": version "1.11.1" resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.11.1.tgz#2bfd767eae1a6996f432ff7e8d7fc75679c0b6a7" @@ -1570,13 +1530,6 @@ abab@^2.0.3, abab@^2.0.5: resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.5.tgz#c0b678fb32d60fc1219c784d6a826fe385aeb79a" integrity sha512-9IK9EadsbHo6jLWIpxpR6pL0sazTXV6+SQv25ZB+F7Bj9mJNaOc4nCRabwd5M/JwmUa8idz6Eci6eKfJryPs6Q== -abort-controller@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/abort-controller/-/abort-controller-3.0.0.tgz#eaf54d53b62bae4138e809ca225c8439a6efb392" - integrity sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg== - dependencies: - event-target-shim "^5.0.0" - accepts@~1.3.4, accepts@~1.3.8: version "1.3.8" resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.8.tgz#0bf0be125b67014adcb0b0921e62db7bffe16b2e" @@ -1965,6 +1918,13 @@ bundle-require@^3.1.2: dependencies: load-tsconfig "^0.2.0" +busboy@^1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/busboy/-/busboy-1.6.0.tgz#966ea36a9502e43cdb9146962523b92f531f6893" + integrity sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA== + dependencies: + streamsearch "^1.1.0" + bytes@3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.0.tgz#f6cf7933a360e0588fa9fde85651cdc7f805d1f6" @@ -2438,11 +2398,6 @@ dargs@^7.0.0: resolved "https://registry.yarnpkg.com/dargs/-/dargs-7.0.0.tgz#04015c41de0bcb69ec84050f3d9be0caf8d6d5cc" integrity sha512-2iy1EkLdlBzQGvbweYRFxmFath8+K7+AKB0TlhHWkNuH+TmovaMH/Wp7V7R4u7f4SnX3OgLsU9t1NI9ioDnUpg== -data-uri-to-buffer@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-3.0.1.tgz#594b8973938c5bc2c33046535785341abc4f3636" - integrity sha512-WboRycPNsVw3B3TL559F7kuBUM4d8CgMEvk6xEJlOp7OBPjt6G7z8WMWlD2rOFZLk6OYfFIUGsCOWzcQH9K2og== - data-urls@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/data-urls/-/data-urls-2.0.0.tgz#156485a72963a970f5d5821aaf642bef2bf2db9b" @@ -2925,11 +2880,6 @@ etag@~1.8.1: resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" integrity sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc= -event-target-shim@^5.0.0: - version "5.0.1" - resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789" - integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ== - events@^3.2.0: version "3.3.0" resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400" @@ -4868,11 +4818,6 @@ mri@1.1.4: resolved "https://registry.yarnpkg.com/mri/-/mri-1.1.4.tgz#7cb1dd1b9b40905f1fac053abe25b6720f44744a" integrity sha512-6y7IjGPm8AzlvoUrwAaw1tLnUBudaS3752vcd8JtrpGGQn+rXIe63LFVHm/YMwtqAuh+LJPCFdlLYPWM1nYn6w== -mrmime@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/mrmime/-/mrmime-1.0.1.tgz#5f90c825fad4bdd41dc914eff5d1a8cfdaf24f27" - integrity sha512-hzzEagAgDyoU1Q6yg5uI+AorQgdvMCur3FcKf7NhMKWsaYg+RnbTyHRa/9IlLF9rf455MOCtcqqrQQ83pPP7Uw== - ms@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" @@ -6075,6 +6020,11 @@ stream-shift@^1.0.0: resolved "https://registry.yarnpkg.com/stream-shift/-/stream-shift-1.0.1.tgz#d7088281559ab2778424279b0877da3c392d5a3d" integrity sha512-AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ== +streamsearch@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/streamsearch/-/streamsearch-1.1.0.tgz#404dd1e2247ca94af554e841a8ef0eaa238da764" + integrity sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg== + strict-event-emitter@^0.4.6: version "0.4.6" resolved "https://registry.yarnpkg.com/strict-event-emitter/-/strict-event-emitter-0.4.6.tgz#ff347c8162b3e931e3ff5f02cfce6772c3b07eb3" @@ -6583,6 +6533,13 @@ unbox-primitive@^1.0.2: has-symbols "^1.0.3" which-boxed-primitive "^1.0.2" +undici@^5.20.0: + version "5.20.0" + resolved "https://registry.yarnpkg.com/undici/-/undici-5.20.0.tgz#6327462f5ce1d3646bcdac99da7317f455bcc263" + integrity sha512-J3j60dYzuo6Eevbawwp1sdg16k5Tf768bxYK4TUJRH7cBM4kFCbf3mOnM/0E3vQYXvpxITbbWmBafaDbxLDz3g== + dependencies: + busboy "^1.6.0" + universalify@^0.1.0, universalify@^0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" @@ -6688,7 +6645,7 @@ watchpack@^2.2.0: glob-to-regexp "^0.4.1" graceful-fs "^4.1.2" -web-encoding@1.1.5, web-encoding@^1.1.5: +web-encoding@^1.1.5: version "1.1.5" resolved "https://registry.yarnpkg.com/web-encoding/-/web-encoding-1.1.5.tgz#fc810cf7667364a6335c939913f5051d3e0c4864" integrity sha512-HYLeVCdJ0+lBYV2FvNZmv3HJ2Nt0QYXqZojk3d9FJOLkwnuhzM9tmamh8d7HPM8QqjKH8DeHkFTx+CFlWpZZDA== @@ -6697,11 +6654,6 @@ web-encoding@1.1.5, web-encoding@^1.1.5: optionalDependencies: "@zxing/text-encoding" "0.9.0" -web-streams-polyfill@^3.1.1: - version "3.2.1" - resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz#71c2718c52b45fd49dbeee88634b3a60ceab42a6" - integrity sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q== - webidl-conversions@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871"