File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -2,9 +2,18 @@ async function getResponseBody(response: Response): Promise<any> {
2
2
try {
3
3
const contentType = response.headers.get('Content-Type');
4
4
if (contentType) {
5
- const isJSON = contentType.toLowerCase().startsWith('application/json');
5
+
6
+ const jsonTypes = ['application/json', 'application/problem+json']
7
+ const isJSON = jsonTypes.some(type => contentType.toLowerCase().startsWith(type));
8
+
9
+ //Check for the blob types
10
+ const blobTypes = ['application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']
11
+ const isBlob = blobTypes.some(type => contentType.toLowerCase().startsWith(type));
12
+
6
13
if (isJSON) {
7
- return await response.json();
14
+ return await response.json();
15
+ } else if (isBlob) {
16
+ return await response.arrayBuffer();
8
17
} else {
9
18
return await response.text();
10
19
}
You can’t perform that action at this time.
0 commit comments