Skip to content

Conversation

@Telroshan
Copy link
Collaborator

Description

In a multipart/form-data form, current implementation with the proxied FormData results in requests being malformed (wrong content type set to text/plain, FormData sent as [object FormData] in the payload)
Couldn't get the proxy object to work properly with XMLHTTPRequest's send method; even though calls are being forwarded to the underlying FormData through the proxy, the request won't set its type to multipart/form-data when appropriate and instead send a text/plain request.
One simple fix/workaround here is to copy the values into a new, actual FormData (not a proxied one)

Corresponding issue:
#2317
Also see this JSFiddle to reproduce the issue

Testing

Didn't know how to add a reliable test for this tbh, given that we mock the requests in our test suite

Checklist

  • I have read the contribution guidelines
  • I have targeted this PR against the correct branch (master for website changes, dev for
    source changes)
  • This is either a bugfix, a documentation update, or a new feature that has been explicitly
    approved via an issue
  • I ran the test suite locally (npm run test) and verified that it succeeded
Couldn't get the proxy object to work properly with XMLHTTPRequest's send method.
Even though calls are being forwarded to its underlying FormData through the proxy, the request won't set its type to multipart/form-data when appropriate and instead send a text/plain request
@Telroshan Telroshan added the bug Something isn't working label Apr 14, 2024
@1cg 1cg merged commit 54381a2 into bigskysoftware:dev Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

2 participants