mirror of
https://github.com/flarum/core.git
synced 2025-07-18 07:11:17 +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 f5cab714e1
This commit is contained in:
@@ -438,6 +438,10 @@ export default class Application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if (responseText === '') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return JSON.parse(responseText);
|
return JSON.parse(responseText);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw new RequestError<ResponseType>(500, `${responseText}`, options, xhr);
|
throw new RequestError<ResponseType>(500, `${responseText}`, options, xhr);
|
||||||
|
Reference in New Issue
Block a user