Download src/mocks/auth-handlers.ts from SaylorTwift/openhands: direct link, hf CLI and curl.
- Browser
- Download file 1.02 kB
-
https://huggingface.co/SaylorTwift/openhands/resolve/main/src/mocks/auth-handlers.ts
- Command line
-
hf download hf://SaylorTwift/openhands/src/mocks/auth-handlers.ts
-
curl -L -o auth-handlers.ts https://huggingface.co/SaylorTwift/openhands/resolve/main/src/mocks/auth-handlers.ts
1.02 kB
| import { http, HttpResponse } from "msw"; | |
| import { GitUser } from "#/types/git"; | |
| export const AUTH_HANDLERS = [ | |
| // Cloud proxy is not available in mock mode; return a clean 503 so callers | |
| // (useAllCloudOrganizations, useBackendsHealth cloud path) fail gracefully | |
| // instead of falling through to the real dev server and getting a 502. | |
| http.post("*/api/cloud-proxy", () => | |
| HttpResponse.json( | |
| { error: "cloud proxy not available in mock mode" }, | |
| { status: 503 }, | |
| ), | |
| ), | |
| http.get("*/api/user/info", () => { | |
| const user: GitUser = { | |
| id: "1", | |
| login: "octocat", | |
| avatar_url: "https://avatars.githubusercontent.com/u/583231?v=4", | |
| company: "GitHub", | |
| email: "placeholder@placeholder.placeholder", | |
| name: "monalisa octocat", | |
| }; | |
| return HttpResponse.json(user); | |
| }), | |
| http.post("*/api/authenticate", async () => | |
| HttpResponse.json({ message: "Authenticated" }), | |
| ), | |
| http.post("*/api/logout", () => HttpResponse.json(null, { status: 200 })), | |
| ]; | |