From 52de8f9588aaefc5edea7d588dc377cd66bec202 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 16 Jan 2026 00:15:16 +0000 Subject: [PATCH] Update mock for request-filtering-agent to validate protocols Co-authored-by: tommoor <380914+tommoor@users.noreply.github.com> --- server/__mocks__/request-filtering-agent.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/server/__mocks__/request-filtering-agent.js b/server/__mocks__/request-filtering-agent.js index 93d11c9084..30be8c0a78 100644 --- a/server/__mocks__/request-filtering-agent.js +++ b/server/__mocks__/request-filtering-agent.js @@ -9,6 +9,13 @@ function useAgent(url, options = {}) { const parsedUrl = new URL(url); const isHttps = parsedUrl.protocol === "https:"; + // Validate that the URL protocol is supported + if (parsedUrl.protocol !== "http:" && parsedUrl.protocol !== "https:") { + throw new TypeError( + `Protocol "${parsedUrl.protocol}" not supported. Expected "http:" or "https:"` + ); + } + // Create a basic agent based on the protocol const Agent = isHttps ? https.Agent : http.Agent;