mirror of
https://github.com/flarum/framework.git
synced 2025-02-22 02:59:40 +08:00
Fix errors on 20X responses with no body
`''` is not json-parsable, so in that case we return null. This was the behavior prior to f5cab714e1b78d5690601738e5fbce2a33733645
This commit is contained in:
parent
deff342985
commit
b14f7d9963
@ -438,6 +438,10 @@ export default class Application {
|
||||
}
|
||||
|
||||
try {
|
||||
if (responseText === '') {
|
||||
return null;
|
||||
}
|
||||
|
||||
return JSON.parse(responseText);
|
||||
} catch (e) {
|
||||
throw new RequestError<ResponseType>(500, `${responseText}`, options, xhr);
|
||||
|
Loading…
x
Reference in New Issue
Block a user