From 079a8100442108b233b0cf109ad87393eee0f67d Mon Sep 17 00:00:00 2001 From: M Date: Fri, 10 Feb 2017 11:26:51 +1300 Subject: [PATCH 1/2] rpc.js: fixed issue: #736 --- lib/browser/rpc.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/browser/rpc.js b/lib/browser/rpc.js index e77a2f56..88fc0d94 100644 --- a/lib/browser/rpc.js +++ b/lib/browser/rpc.js @@ -179,7 +179,12 @@ function makeRequest(url, data) { // The global __debug__ object is provided by Visual Studio Code. if (global.__debug__) { let request = global.__debug__.require('sync-request'); - let response = request('POST', url, {json: data}); + let response = request('POST', url, { + body: Buffer.from(JSON.stringify(data)), + headers: { + "Content-Type": "text/plain;charset=UTF-8" + } + }); statusCode = response.statusCode; responseText = response.body.toString('utf-8'); From 0ec11ce16e66845b166c9991f28456efba9deefe Mon Sep 17 00:00:00 2001 From: M Date: Fri, 10 Feb 2017 18:28:03 +1300 Subject: [PATCH 2/2] rpc.js: removed Buffer.from There hasn't Buffer Object in react native environment. --- lib/browser/rpc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/browser/rpc.js b/lib/browser/rpc.js index 88fc0d94..427df21e 100644 --- a/lib/browser/rpc.js +++ b/lib/browser/rpc.js @@ -180,7 +180,7 @@ function makeRequest(url, data) { if (global.__debug__) { let request = global.__debug__.require('sync-request'); let response = request('POST', url, { - body: Buffer.from(JSON.stringify(data)), + body: JSON.stringify(data), headers: { "Content-Type": "text/plain;charset=UTF-8" }