Use fetch to post a blob in react-native
12,243
My project had same problem before, according to this issue perhaps, blob data is not supported in react native fetch
API currently (Both in send and receive).
So I made a module myself ..
https://github.com/wkh237/react-native-fetch-blob
It works fine in our project, if you don't mind to take a look, it might helps.
Author by
ssomnoremac
Updated on June 12, 2022Comments
-
ssomnoremac about 2 years
I'm trying to post a blob. It's definitely a blob. This isn't working in react-native though. I'm getting a red screen that says "PUT must have a request body". Well, I've put the blob in the request body.
createAttachment: function(url, blob) { var settings = { method: "PUT", headers: { 'Accept': 'image/jpeg', 'Content-Type': 'image/jpeg', 'If-Match': '*', }, body: blob }; return fetch(url, settings) }