This commit is contained in:
parent
a815112fb9
commit
7693e7055b
@ -16,6 +16,13 @@ export default class WebRequest {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Resolve with a buffer if the content type is an image
|
||||||
|
if (response.headers.get("content-type")?.includes("image/")) {
|
||||||
|
const arrayBuffer = await response.arrayBuffer();
|
||||||
|
resolve(Buffer.from(arrayBuffer) as unknown as T);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
|
|
||||||
// Reject if the status code is not 200
|
// Reject if the status code is not 200
|
||||||
|
Loading…
Reference in New Issue
Block a user