Commit f0179a0b authored by 郑磊's avatar 郑磊

更新JSON解析

parent d4dfd31e
......@@ -107,7 +107,7 @@ function request<T = any>(
} = options
const xhr = new XMLHttpRequest()
xhr.responseType = 'json'
xhr.responseType = 'text'
xhr.withCredentials = withCredentials
if (typeof timeout === 'number') {
xhr.timeout = timeout
......@@ -121,7 +121,7 @@ function request<T = any>(
resolve({
status: xhr.status,
headers: parseResponseHeaders(xhr),
data: xhr.response,
data: JSON.parse(xhr.responseText),
})
})
xhr.addEventListener('readystatechange', function () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment