Skip to content
Snippets Groups Projects
Unverified Commit 68a508fc authored by Alex Yang's avatar Alex Yang Committed by GitHub
Browse files

test: fix check host (#829)

parent 6281fc8c
No related branches found
No related tags found
No related merge requests found
......@@ -11,8 +11,8 @@ globalThis.fetch = function fetch(...args: Parameters<typeof originalFetch>) {
url = url.toString();
}
}
const parsedUrl = new URL(url);
if (parsedUrl.hostname.includes("openai.com")) {
const { host } = new URL(url);
if (host.endsWith("openai.com")) {
// todo: mock api using https://mswjs.io
throw new Error(
"Make sure to return a mock response for OpenAI API requests in your test.",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment