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

XMLHttpRequest FormData / File upload never resolves #2326

Open
4 tasks done
ondrejsevcik opened this issue Oct 23, 2024 · 6 comments
Open
4 tasks done

XMLHttpRequest FormData / File upload never resolves #2326

ondrejsevcik opened this issue Oct 23, 2024 · 6 comments
Labels
bug Something isn't working needs:triage Issues that have not been investigated yet. scope:node Related to MSW running in Node

Comments

@ondrejsevcik
Copy link

ondrejsevcik commented Oct 23, 2024

Prerequisites

Environment check

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

Node.js version

v20.14.0

Reproduction repository

https://github.com/ondrejsevcik/msw-xhr-upload-issues

Reproduction steps

The reproduction repository contains two tests. One is firing an XHR request, and the other one is firing an XHR request with a FormData body.

If you use v2.4.3, the tests will pass. When using version 2.4.4+ it fails.

  1. npm install
  2. npm run test

Current behavior

The XHR request with FormData never resolves. This has worked fine previously, but since version 2.4.4, it does not work anymore.

Expected behavior

It is possible to upload file / FormData with msw using XMLHttpRequest.

@ondrejsevcik ondrejsevcik added bug Something isn't working needs:triage Issues that have not been investigated yet. scope:node Related to MSW running in Node labels Oct 23, 2024
@kibertoad
Copy link

@kettanaito Most likely related to this change: Adopts a new, Socket-based request interception algorithm.

@roastnewt
Copy link

I am encountering the same issue

@LarsJK
Copy link

LarsJK commented Nov 8, 2024

I am also encountering this, but only on linux. On my Mac it works fine. What OS are you using?

@roastnewt
Copy link

Windows. And also in our Ubuntu build/test pipeline

@RabbitShare
Copy link

RabbitShare commented Nov 13, 2024

Same issue on Mac and Debian. Node v22.11.0

@RabbitShare
Copy link

Also example from documentation not working https://mswjs.io/docs/recipes/file-uploads/

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