Skip to content

Commit

Permalink
set response type to 'text' if Accept header supports it
Browse files Browse the repository at this point in the history
  • Loading branch information
FrikkieSnyman committed Mar 13, 2024
1 parent c1c13ff commit 7a30ffe
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,9 @@ export function fetch(input, init) {
}

if ('responseType' in xhr) {
if (support.blob) {
if (request.headers.get("Accept") && (request.headers.get("Accept").indexOf("application/json") !== -1 || request.headers.get("Accept").indexOf("text/plain") !== -1)) {
xhr.responseType = 'text';
} else if (support.blob) {
xhr.responseType = 'blob'
} else if (
support.arrayBuffer
Expand Down

0 comments on commit 7a30ffe

Please sign in to comment.