Update mock for request-filtering-agent to validate protocols

Co-authored-by: tommoor <380914+tommoor@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]andtommoor committed 2026-01-16 00:15:16 +00:00
1 parent 9dbb84f966
commit 52de8f9588
1 file changed
+7
@@ -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;