fix: 非 json 格式错误无法展示
This commit is contained in:
@@ -165,8 +165,15 @@ class Client {
|
||||
body: form,
|
||||
credentials: 'omit',
|
||||
})
|
||||
const text = await (await re.blob()).text()
|
||||
let json
|
||||
try {
|
||||
json = JSON.parse(text)
|
||||
} catch(_) {}
|
||||
return {
|
||||
...await re.json(),
|
||||
...(json == null ? {
|
||||
msg: text
|
||||
} : json),
|
||||
code: re.status,
|
||||
} as ApiCallbackMessage
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user