瀏覽代碼

Don't stringify body if Content-Type is application/json

Mike Monteith 8 年之前
父節點
當前提交
e6a9c179c4
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1
    1
      src/polyfill/Fetch.js

+ 1
- 1
src/polyfill/Fetch.js 查看文件

@@ -47,7 +47,7 @@ class RNFetchBlobFetchPolyfill {
47 47
         // When request body is a Blob, use file URI of the Blob as request body.
48 48
         else if (body.isRNFetchBlobPolyfill)
49 49
           promise = Promise.resolve(RNFetchBlob.wrap(body.blobPath))
50
-        else if (typeof body !== 'object')
50
+        else if (typeof body !== 'object' && options.headers['Content-Type'] !== 'application/json')
51 51
           promise = Promise.resolve(JSON.stringify(body))
52 52
         else if (typeof body !== 'string')
53 53
           promise = Promise.resolve(body.toString())