Improve fetch errors with looser mime-type detection (#1047).

This commit is contained in:
Richard Moore 2020-09-15 22:12:56 -04:00
parent e8a9eea493
commit 263bfe5ce6
No known key found for this signature in database
GPG Key ID: 665176BE8E9DC651

@ -23,7 +23,7 @@ function bodyify(value: any, type: string): string {
if (typeof(value) === "string") { return value; }
if (isBytesLike(value)) {
if (type && (type.split("/")[0] === "text" || type === "application/json")) {
if (type && (type.split("/")[0] === "text" || type.split(";")[0].trim() === "application/json")) {
try {
return toUtf8String(value);
} catch (error) { };