Skip to content

Commit

Permalink
Fix issue #4735: Update msw mocks (#4736)
Browse files Browse the repository at this point in the history
  • Loading branch information
openhands-agent authored Nov 4, 2024
1 parent 966da7b commit ba25b02
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions frontend/src/mocks/handlers.ts
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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({
Expand Down Expand Up @@ -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 }),
),
];

0 comments on commit ba25b02

Please sign in to comment.