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

post request results in timeout when providing body, header, or both #1182

Closed
4 tasks done
mbastian93 opened this issue Mar 29, 2022 · 5 comments
Closed
4 tasks done
Labels
bug Something isn't working needs:triage Issues that have not been investigated yet. scope:node Related to MSW running in Node

Comments

@mbastian93
Copy link

Prerequisites

Environment check

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

Node.js version

14 / 16

Reproduction repository

https://codesandbox.io/s/laughing-ully-x4wt2w

Reproduction steps

open provided CodeSandbox and run npm test; only the test case executing a POST request with neither body nor header provided succeeds, the others fail

Current behavior

When providing data (i.e. body) to a POST request, the test ends in a timeout.
A breakpoint within the request handler of the 'mocked server' is not even reached.

The exact same request when used against a 'real' nodeJS server (express)

Expected behavior

The tests should not result in a timeout and instead get processed by the handler.

I can not rule out, that my set up is wrong, however i followed the instructions to the best of my knowledge and understanding

@mbastian93 mbastian93 added bug Something isn't working needs:triage Issues that have not been investigated yet. scope:node Related to MSW running in Node labels Mar 29, 2022
@mbastian93
Copy link
Author

Okay i just noticed: when using jest/babel-jest v^26.0.0 it works as expect.
Therefore there must be an issue with v27 of those libaries

@kettanaito
Copy link
Member

Hey, @mbastian93. Thanks for reporting this.

I'm not sure how Jest 26 resolves this, afaik the only relevant change in 27 was the removal of setImmediate and some internal work on timers.

I can confirm that the sandbox above has its tests passing if I use node-fetch and not axios. The latest MSW has an issue with how Axios works (see #1169). I'm closing this as a duplicate.

@dlvhdr
Copy link

dlvhdr commented Apr 28, 2022

I'm facing the same issue :(

@josuevalrob
Copy link

oh fck, same issue for me

@pqkluan
Copy link

pqkluan commented Jun 9, 2022

Related to #1125

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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

5 participants