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

Malformed multipart/form-data upload - koa servers are unable to process it #11759

Closed
dylanpyle opened this issue Jan 6, 2017 · 1 comment
Closed
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@dylanpyle
Copy link

dylanpyle commented Jan 6, 2017

I'm going to close this immediately, since I haven't conclusively isolated this to React Native, but figured I should document it in case someone else hits this behavior.

There seems to be some sort of incompatibility between the multipart/form-data request generated by React Native's XHR and fetch implementations, and the request body expected by all the koa middleware's I've tested (koa-body, koa-better-body, koa-multer). This causes the server to silently fail to parse the body, about 50-75% of the time.

It doesn't seem to be a race condition or similar — replaying the same requests will deterministically either succeed or fail, depending on the request body.

Here's a request that fails:
headers
body

And one that succeeds:
headers
body

The only client I found that caused this specific failure mode was the JavaScript XHR / fetch API in React Native. I haven't figured out whether the misbehavior here is on the client or server, but I've managed to avoid it by switching my client to use RNFetchBlob instead.

Cross-post: koajs/koa-body#45

@dylanpyle
Copy link
Author

Turns out this was the same issue as #11342 — now resolved!

@facebook facebook locked as resolved and limited conversation to collaborators May 24, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

2 participants