joltup / rn-fetch-blob

A project committed to making file access and data transfer easier, efficient for React Native developers.
MIT License
2.82k stars 774 forks source link

RNFetchBlob.fetch PUT, multipart/formdata doesn't work on android #52

Open kanekv opened 6 years ago

kanekv commented 6 years ago

Installed version: version "0.10.8" resolved "https://registry.yarnpkg.com/react-native-fetch-blob/-/react-native-fetch-blob-0.10.8.tgz#4fc256abae0cb5f10e7c41f28c11b3ff330d72a9"

Sending PUT request with multipart/formdata sends empty body on android.

tombailey commented 6 years ago

Can you provide a test case which replicates problem?

Traviskn commented 6 years ago

It looks like you have the old version of react-native-fetch-blob, can you confirm that this issue still occurs when using the latest version of rn-fetch-blob?

kanekv commented 6 years ago

I will have to test it - I think the issue was that on android everything is expected to be string, numbers are not accepted and on ios it's ok to have numbers.

ognjetina commented 5 years ago

Any info on this? I am using rn-fetch-blob version "^0.10.15" And when I use PUT method backend is receiving a request without parameters...

sasha-nechaiev commented 5 years ago

I've debugged java and found that using nmultipart/formdata if type is not specified for some field here https://github.com/joltup/rn-fetch-blob/blob/d8c79f6b261e7bd76b477f2b304379b1dbeb8836/android/src/main/java/com/RNFetchBlob/RNFetchBlobBody.java#L397 it wants to convert it to string. To solve your issue make sure that you specified "type" for each non-string field or set them to string type. @kanekv

lucasluca commented 3 years ago

Same issue here

thuantvDr4 commented 3 years ago

I've debugged java and found that using nmultipart/formdata if type is not specified for some field here

https://github.com/joltup/rn-fetch-blob/blob/d8c79f6b261e7bd76b477f2b304379b1dbeb8836/android/src/main/java/com/RNFetchBlob/RNFetchBlobBody.java#L397

it wants to convert it to string. To solve your issue make sure that you specified "type" for each non-string field or set them to string type. @kanekv

Yes thank, my issue is resolved!