apipeline
apipeline copied to clipboard
How to post raw data as JSON
Hi,
I need to post raw JSON data in fetch api without using JSON.stringify() in body.
Hi, I haven't tried it, but you should be able to do it like this
api.fetch(
'yourService',
{
fetchOptions: {
body: yourJsonData
}
}
)
fetchOptions basically allows you to tweak the final request options with all the configuration you'd use when using react-native's fetch directly. So this shouldn't be tied to react-native-offline-api.
In my case fetch method appends utf8 like this "application/json; charset=utf-8". how to solve this by not appending utf8.
Thanks