Files
RSSHub/patches/@mswjs__interceptors@0.41.3.patch
T
dependabot[bot]andTony df6b73d866 chore(deps-dev): bump msw from 2.4.3 to 2.12.14 (#21483)
* chore(deps-dev): bump msw from 2.4.3 to 2.12.14

Bumps [msw](https://github.com/mswjs/msw) from 2.4.3 to 2.12.14.
- [Release notes](https://github.com/mswjs/msw/releases)
- [Changelog](https://github.com/mswjs/msw/blob/main/CHANGELOG.md)
- [Commits](https://github.com/mswjs/msw/compare/v2.4.3...v2.12.14)

---
updated-dependencies:
- dependency-name: msw
  dependency-version: 2.12.14
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* chore: remove supertest

MSW's setupServer() works by patching Node's http module (via @mswjs/interceptors) to intercept outgoing requests. supertest's requests to http://127.0.0.1:1200 go through the same patched http module which causes server bad request

* chore(patch): add patch for @mswjs/interceptors@0.41.3

* fix(server): update server listen options to bypass unhandled requests

* chore: update patch for @mswjs/interceptors

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tony <TonyRL@users.noreply.github.com>
2026-03-25 02:31:42 +08:00

22 lines
1.2 KiB
Diff

diff --git a/lib/node/ClientRequest-Ca8Qykuv.mjs b/lib/node/ClientRequest-Ca8Qykuv.mjs
index c123d7d2f63f5ddba9fc47ace83d6ddbc6570329..5ceda7dc46f142692ae19179d58b4e6f410cd199 100644
--- a/lib/node/ClientRequest-Ca8Qykuv.mjs
+++ b/lib/node/ClientRequest-Ca8Qykuv.mjs
@@ -199,7 +199,7 @@ function restoreHeadersPrototype() {
function getRawFetchHeaders(headers) {
if (!Reflect.has(headers, kRawHeaders)) return Array.from(headers.entries());
const rawHeaders = Reflect.get(headers, kRawHeaders);
- return rawHeaders.length > 0 ? rawHeaders : Array.from(headers.entries());
+ return rawHeaders && rawHeaders.length > 0 ? rawHeaders : Array.from(headers.entries());
}
/**
* Infers the raw headers from the given `HeadersInit` provided
@@ -298,6 +298,7 @@ var MockHttpSocket = class extends MockSocket {
const headers = FetchResponse.parseRawHeaders([...this.requestRawHeadersBuffer, ...rawHeaders || []]);
this.requestRawHeadersBuffer.length = 0;
const canHaveBody = method !== "GET" && method !== "HEAD";
+ if (method === "CONNECT") { return; }
if (url.username || url.password) {
if (!headers.has("authorization")) headers.set("authorization", `Basic ${url.username}:${url.password}`);
url.username = "";