Fix POST Content-type: application/json

some RESTful backend unable to parse
This commit is contained in:
metal A-wing 2018-02-10 10:26:11 +08:00 committed by YongXin Shi
parent 06012e16e0
commit f72764ab88

View File

@ -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 });
});
}
};
};