Fix issue #4735: Update msw mocks (#4736)

This commit is contained in:
OpenHands
2024-11-04 11:58:56 -05:00
committed by GitHub
parent 966da7b7c8
commit ba25b02978

View File

@@ -1,7 +1,7 @@
import { delay, http, HttpResponse } from "msw";
const openHandsHandlers = [
http.get("http://localhost:3000/api/options/models", async () => {
http.get("http://localhost:3001/api/options/models", async () => {
await delay();
return HttpResponse.json([
"gpt-3.5-turbo",
@@ -10,17 +10,17 @@ const openHandsHandlers = [
]);
}),
http.get("http://localhost:3000/api/options/agents", async () => {
http.get("http://localhost:3001/api/options/agents", async () => {
await delay();
return HttpResponse.json(["CodeActAgent", "CoActAgent"]);
}),
http.get("http://localhost:3000/api/options/security-analyzers", async () => {
http.get("http://localhost:3001/api/options/security-analyzers", async () => {
await delay();
return HttpResponse.json(["mock-invariant"]);
}),
http.get("http://localhost:3000/api/list-files", async ({ request }) => {
http.get("http://localhost:3001/api/list-files", async ({ request }) => {
await delay();
const token = request.headers
@@ -32,11 +32,11 @@ const openHandsHandlers = [
return HttpResponse.json(["file1.ts", "dir1/file2.ts", "file3.ts"]);
}),
http.post("http://localhost:3000/api/save-file", () =>
http.post("http://localhost:3001/api/save-file", () =>
HttpResponse.json(null, { status: 200 }),
),
http.get("http://localhost:3000/api/select-file", async ({ request }) => {
http.get("http://localhost:3001/api/select-file", async ({ request }) => {
await delay();
const token = request.headers
@@ -58,7 +58,7 @@ const openHandsHandlers = [
return HttpResponse.json(null, { status: 404 });
}),
http.post("http://localhost:3000/api/submit-feedback", async () => {
http.post("http://localhost:3001/api/submit-feedback", async () => {
await delay(1200);
return HttpResponse.json({
@@ -87,7 +87,10 @@ export const handlers = [
{ id: 2, full_name: "octocat/earth" },
]);
}),
http.post("http://localhost:3000/api/submit-feedback", async () =>
http.post("http://localhost:3001/api/submit-feedback", async () =>
HttpResponse.json({ statusCode: 200 }, { status: 200 }),
),
http.post("https://us.i.posthog.com/e", async () =>
HttpResponse.json(null, { status: 200 }),
),
];