mirror of
https://github.com/flarum/core.git
synced 2025-06-01 03:55:13 +02: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 bac0e594eed0a8e7282c4772864075cac487d280
This commit is contained in:
parent
09fdd4cb6d
commit
9b639e09f2
@ -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