File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change 1
1
async function getResponseBody(response: Response): Promise<any > {
2
2
try {
3
3
const contentType = response.headers.get('Content-Type');
4
+ const contentDisposition = response.headers.get('Content-Disposition');
5
+
4
6
if (contentType) {
5
7
6
8
const jsonTypes = ['application/json', 'application/problem+json']
@@ -12,9 +14,15 @@ async function getResponseBody(response: Response): Promise<any> {
12
14
13
15
if (isJSON) {
14
16
return await response.json();
15
- } else if (isBlob) {
16
- return await response.arrayBuffer();
17
- } else {
17
+ }else if (isBlob) {
18
+ const arrayBuffer = await response.arrayBuffer();
19
+
20
+ if(contentDisposition) {
21
+ return [contentDisposition, arrayBuffer];
22
+ } else {
23
+ return arrayBuffer;
24
+ }
25
+ } else {
18
26
return await response.text();
19
27
}
20
28
}
You can’t perform that action at this time.
0 commit comments