FormData not being sent in Request
See original GitHub issueMy goal is to send an image to my backend.
What I’m doing to send the request
const data = new FormData();
data.append('file', {
name: 'some_random_name.jpg',
type: 'image/jpeg',
path: getURI()
});
await fetchSSL('/api/files', {
method: 'PUT',
headers: {
'Accept': 'application/json',
'User-Agent': userAgent
},
disableAllSecurity: true, // for easier testing
pkPinning: false, // for easier testing
sslPinning: {
certs: [] // for easier testing
},
body: {
formData: data
}
})
the form data being passed, can be seen in the screenshot
I intercepted the request before it hit my servers and it appears the form data has not been appended (this looks different when not using this library):
The library itself also does not give me any notice about something going wrong. Of course, I get an error in the response from my server, but i would expected to get some kind of error.
I have tried to use the example from your readme. So the multi-part/form content type header has already been omitted. I also see the form Data being used when i added some logging statements to your native coe
I have seen in other issues that you recommended using base64, but when i have both path
and data
, the data seems to not have any effect, and only using data
caused an error somehow like (https://github.com/MaxToyberman/react-native-ssl-pinning/issues/38)
I would greatly appreciate your help, since your library seems to be the only way to provide ssl pinning while also having a feedback to the react native js code to show some nice alerts if something goes wrong. However, not being able to upload images makes this unusable, since this is a hard requirement for us.
Context: RN Version: 0.63.3 RN-SSL-Pinning Version: 1.5.4 OS: iOS (have not validated Android) Normal json body payloads work fine When ditching this library and using default react native fetch method, it also works fine
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:13 (3 by maintainers)
@Nageshwar1213 No sadly not. We have essentially put the effort to do ssl pinning on hold until this is issue is resolved…
HI @BerniWittmann did u got the solution for this issue .please let me know I am struggling to resolve this issue .