mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-22 11:45:59 +01:00
Don't try and parse a json response if one is not received (#3574)
This commit is contained in:
parent
25caeaa26f
commit
f72ef2dce5
@ -2323,7 +2323,9 @@ export class ApiService implements ApiServiceAbstraction {
|
||||
requestInit.headers = headers;
|
||||
const response = await this.fetch(new Request(requestUrl, requestInit));
|
||||
|
||||
if (hasResponse && response.status === 200) {
|
||||
const responseType = response.headers.get("content-type");
|
||||
const responseIsJson = responseType != null && responseType.indexOf("application/json") !== -1;
|
||||
if (hasResponse && response.status === 200 && responseIsJson) {
|
||||
const responseJson = await response.json();
|
||||
return responseJson;
|
||||
} else if (response.status !== 200) {
|
||||
|
Loading…
Reference in New Issue
Block a user