From ba25b02978dac9da920a8b4bff2deee739ae988f Mon Sep 17 00:00:00 2001 From: OpenHands Date: Mon, 4 Nov 2024 11:58:56 -0500 Subject: [PATCH] Fix issue #4735: Update msw mocks (#4736) --- frontend/src/mocks/handlers.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/frontend/src/mocks/handlers.ts b/frontend/src/mocks/handlers.ts index bde27d21f76..7bd290e79c8 100644 --- a/frontend/src/mocks/handlers.ts +++ b/frontend/src/mocks/handlers.ts @@ -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 }), + ), ];