From 4073785f934c1051d01131750426e14d8354ac9f Mon Sep 17 00:00:00 2001 From: Victor Westerlund Date: Sun, 31 Oct 2021 13:23:58 +0100 Subject: [PATCH] Fix `Content-Type` test false negative Some servers will append extra stuff (like encoding) to the `Content-Type` response header. This fixes that --- Monkeydo.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Monkeydo.mjs b/Monkeydo.mjs index 9fed33f..5319ee8 100644 --- a/Monkeydo.mjs +++ b/Monkeydo.mjs @@ -64,7 +64,7 @@ export default class Monkeydo extends MonkeyWorker { const fetchManifest = await fetch(manifest); // If the URL parsed but the fetch response is invalid, give up and throw an error - if(!fetchManifest.ok || fetchManifest.headers.get("Content-Type") !== "application/json") { + if(!fetchManifest.ok || !fetchManifest.headers.get("Content-Type")?.includes("application/json")) { throw new TypeError(errorPrefix + "Invalid response Content-Type or HTTP status"); } data = await fetchManifest.json();