jameslnewell / xhr-mock

Utility for mocking XMLHttpRequest.
197 stars 48 forks source link

Proxy does not send UrlSearchParams or FormData in real request #62

Open nicholasgonzalezsc opened 6 years ago

nicholasgonzalezsc commented 6 years ago

Bug Description When making a proxied xhr request with application/x-www-form-urlencoded;charset=utf-8 data, the request body is not passed along to the real request.

Expected Behavior Proxy passes the form data to the real request.

nicholasgonzalezsc commented 6 years ago

Hey @jameslnewell, have you had a chance to take a look at this? If you can point me in the right direction, I can help with the change

jameslnewell commented 6 years ago

Sorry @nicholasgonzalezsc I'm on holidays. I'll take a look sometime next week. At a guess I'd say its because we're only passing the responseText, not the response here. Feel free to submit a PR 😁

jameslnewell commented 6 years ago

Checkout v2.3.2. It fixes the proxy to return the correct response body.

Let me know if it doesn't fix your issue.

lk77 commented 5 years ago

Hello, i still have this issue on v2.4.1, form data is missing in request.

if i do :

mock.setup()
mock.use(proxy)

There is no form data, and if i comment those lines, there is form data.

it's a multipart form upload (https://upload.filestackapi.com/multipart/start), perhaps it's the problem here.

thanks.

jameslnewell commented 5 years ago

Thanks @lk77. Could you please provide a code sample using a service like CodeSandbox where I can reproduce the issue?

lk77 commented 5 years ago

Hello, i will try to do so