Use fetch to post blob in native-response

I am trying to post blob. This is definitely a drop. However, this does not work in response. I get a red screen that says: "PUT must have a request body." Well, I put 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) } 
+5
source share
1 answer

My project had the same problem before, according to this problem , maybe the blob data is not supported in the response native fetch API at the moment (both in sending and receiving).

So, I created the module myself.

https://github.com/wkh237/react-native-fetch-blob

It works great in our project, if you do not mind looking, this can help.

+8
source

Source: https://habr.com/ru/post/1244379/


All Articles