From f72764ab88d269d0c33fcd6e2147442346701f39 Mon Sep 17 00:00:00 2001 From: metal A-wing Date: Sat, 10 Feb 2018 10:26:11 +0800 Subject: [PATCH] Fix POST Content-type: application/json some RESTful backend unable to parse --- src/js/api.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/js/api.js b/src/js/api.js index bbdb1a4..8edef4c 100644 --- a/src/js/api.js +++ b/src/js/api.js @@ -24,6 +24,7 @@ const SendXMLHttpRequest = (url, data, success, error, fail) => { }; xhr.open(data !== null ? 'POST' : 'GET', url, true); + xhr.setRequestHeader("Content-type", "application/json; charset=UTF-8"); xhr.send(data !== null ? JSON.stringify(data) : null); }; @@ -50,4 +51,4 @@ export default { callback({ status: xhr.status, response: null }); }); } -}; \ No newline at end of file +};