From 706dca7376bab7e2b492a389cb7352be67f387fb Mon Sep 17 00:00:00 2001 From: Richard Moore Date: Thu, 23 Mar 2023 23:31:31 -0400 Subject: [PATCH] Fixed FetchRequest when using credentials (#3897). --- src.ts/utils/geturl-browser.ts | 2 +- src.ts/utils/geturl.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src.ts/utils/geturl-browser.ts b/src.ts/utils/geturl-browser.ts index 6cb4d3bc5d..9d528f6788 100644 --- a/src.ts/utils/geturl-browser.ts +++ b/src.ts/utils/geturl-browser.ts @@ -35,7 +35,7 @@ export async function getUrl(req: FetchRequest, _signal?: FetchCancelSignal): Pr operation: "request" }); - assert(!req.credentials || req.allowInsecureAuthentication, "insecure authorized connections unsupported", "UNSUPPORTED_OPERATION", { + assert(protocol === "https" || !req.credentials || req.allowInsecureAuthentication, "insecure authorized connections unsupported", "UNSUPPORTED_OPERATION", { operation: "request" }); diff --git a/src.ts/utils/geturl.ts b/src.ts/utils/geturl.ts index 4858333fc1..de024c6da2 100644 --- a/src.ts/utils/geturl.ts +++ b/src.ts/utils/geturl.ts @@ -19,7 +19,7 @@ export async function getUrl(req: FetchRequest, signal?: FetchCancelSignal): Pro operation: "request" }); - assert(!req.credentials || req.allowInsecureAuthentication, "insecure authorized connections unsupported", "UNSUPPORTED_OPERATION", { + assert(protocol === "https" || !req.credentials || req.allowInsecureAuthentication, "insecure authorized connections unsupported", "UNSUPPORTED_OPERATION", { operation: "request" });