fix: some bug at xhr and console

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
2020-02-23 22:33:51 +08:00
parent d9e2b50953
commit e8d41e8a43
3 changed files with 17 additions and 13 deletions

View File

@ -24,8 +24,11 @@ function request(config: RequestConfig) {
for (const header in config.headers) {
xhr.setRequestHeader(header, config.headers[header]);
}
let future = xhr.send(config.data);
return future.get();
xhr.send(config.data);
if ((xhr.getResponseHeader("Content-Type") + '').indexOf('application/json') != -1) {
xhr.responseType = "json"
}
return xhr.get();
}
function _proxy(method: Method) {