Skip to content
This repository has been archived by the owner on Mar 16, 2019. It is now read-only.

polyfill.Fetch object request body (application/json ) being converted to string #160

Closed
mikemonteith opened this issue Oct 19, 2016 · 1 comment

Comments

@mikemonteith
Copy link
Contributor

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.

@wkh237
Copy link
Owner

wkh237 commented Oct 22, 2016

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

@wkh237 wkh237 closed this as completed Nov 7, 2016
mrdeanbw pushed a commit to mrdeanbw/ReactNative_HoopsApp that referenced this issue Aug 7, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants