Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request by got + compression hangs forever #2200

Closed
4 tasks done
tim-coulter opened this issue Jul 5, 2024 · 1 comment
Closed
4 tasks done

Request by got + compression hangs forever #2200

tim-coulter opened this issue Jul 5, 2024 · 1 comment
Labels
bug Something isn't working needs:triage Issues that have not been investigated yet. scope:node Related to MSW running in Node

Comments

@tim-coulter
Copy link

Prerequisites

Environment check

  • I'm using the latest msw version
  • I'm using Node.js version 18 or higher

Node.js version

v22.3.0

Reproduction repository

https://github.com/tim-coulter/msw-got-compression-example

Reproduction steps

npm i
npm run server
npm run test

Note that this is only reproducible with the following:

  • app.use(compression); on the mock server
  • a response which is large enough to require compression
  • the request is sent using got

Current behavior

When the msw server has not started listening both the got and fetch requests work as expected and return a response. When the mock server is started, however, only the fetch request returns a response but the request using got appears to hang (got works 2 is never seen).

Expected behavior

As that request is not being intercepted by msw the behaviour should be exactly the same as before starting the server as after (the request made using got should not hang).

@tim-coulter tim-coulter added bug Something isn't working needs:triage Issues that have not been investigated yet. scope:node Related to MSW running in Node labels Jul 5, 2024
@kettanaito kettanaito changed the title Non-intercepted requests hanging Request by got + compression hangs forever Jul 5, 2024
@kettanaito
Copy link
Member

Hi, @tim-coulter. Thanks for reporting this.

We are working on improving the handling of encoded response bodies in Node.js, and hope to merge the fix in the nearest future. One of such improvements is making Undici expose their encoding utilities (see nodejs/undici#3423) and then forwarding that usage to Interceptors (see mswjs/interceptors#604). Once these two are merged, MSW should handle compressed response bodies correctly in Node.js.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working needs:triage Issues that have not been investigated yet. scope:node Related to MSW running in Node
Projects
None yet
Development

No branches or pull requests

2 participants