React-native-fetch-blob: polyfill.Fetch object request body (application/json ) being converted to string

Created on 19 Oct 2016  路  1Comment  路  Source: wkh237/react-native-fetch-blob

It seems that fetch() calls with a JSON body, the JSON is being converted to a string.

This is the whatwg-fetch way of doing a JSON post:

fetch(URL, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({abc: 123}),
});

I have also tried

fetch(URL, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body: {abc: 123},
});

I think that polyfill.Fetch is converting my JSON-string into a string-containing-a-JSON-string.

beta bug ready to merge

Most helpful comment

@mikemonteith , FYI, I've published 0.10.0-beta.4 which includes your PR 馃憤

>All comments

@mikemonteith , FYI, I've published 0.10.0-beta.4 which includes your PR 馃憤

Was this page helpful?
0 / 5 - 0 ratings