mswjs / interceptors

Low-level network interception library.
https://npm.im/@mswjs/interceptors
MIT License
565 stars 127 forks source link

Headers are not iterable #672

Closed KnisterPeter closed 2 weeks ago

KnisterPeter commented 2 weeks ago

We do see an error between hono and @mswjs/interceptors with our requests. Here is the full stack trace which shows the error:

TypeError: inferRawHeaders(...) is not iterable (cannot read property undefined)
    at Object.construct (file://./node_modules/.pnpm/@mswjs+interceptors@0.36.9/node_modules/@mswjs/interceptors/lib/node/chunk-MG3S53QP.mjs:229:30)
    at new Request (file://./node_modules/.pnpm/@hono+node-server@1.13.5_hono@4.6.9/node_modules/@hono/node-server/dist/index.mjs:29:5)
    at newRequestFromIncoming (file://./node_modules/.pnpm/@hono+node-server@1.13.5_hono@4.6.9/node_modules/@hono/node-server/dist/index.mjs:60:10)
    at [getRequestCache] (file://./node_modules/.pnpm/@hono+node-server@1.13.5_hono@4.6.9/node_modules/@hono/node-server/dist/index.mjs:81:35)
    at Request.get (file://./node_modules/.pnpm/@hono+node-server@1.13.5_hono@4.6.9/node_modules/@hono/node-server/dist/index.mjs:106:35)
    at HonoRequest.header (file://./node_modules/.pnpm/hono@4.6.9/node_modules/hono/dist/request.js:48:23)
    at compress2 (file://./node_modules/.pnpm/hono@4.6.9/node_modules/hono/dist/middleware/compress/index.js:13:30)
    at async dispatch (file://./node_modules/.pnpm/hono@4.6.9/node_modules/hono/dist/compose.js:30:17)
    at async dispatch (file://./node_modules/.pnpm/hono@4.6.9/node_modules/hono/dist/compose.js:30:17)
    at async file://./node_modules/.pnpm/hono@4.6.9/node_modules/hono/dist/hono-base.js:197:25

Somehow the inferRawHeaders function seems to return undefined instead of an empty iterable.

kettanaito commented 2 weeks ago

Hi, @KnisterPeter. Can you please submit a reproduction repo for this? I will take a look then. Thanks.