Domain degisikligi: fristy.net -> fristy.dev

This commit is contained in:
fristy committed 2026-10-15 21:43:19 +03:00
1 parent ed149ded52
commit b98acd0cde
18 files changed
+165 -37

No files matched your search

+6 -6
View File
@@ -9,9 +9,9 @@ afterEach(() => {
function apiRequest(path: string, init?: { method?: string; origin?: string | null }): NextRequest {
const headers = new Headers();
if (init?.origin !== null) {
headers.set("origin", init?.origin ?? "https://fristy.net");
headers.set("origin", init?.origin ?? "https://fristy.dev");
}
return new NextRequest(`https://fristy.net${path}`, {
return new NextRequest(`https://fristy.dev${path}`, {
method: init?.method ?? "GET",
headers,
});
@@ -21,19 +21,19 @@ describe("proxy /api/*", () => {
it("answers OPTIONS preflight with CORS headers", () => {
const response = proxy(apiRequest("/api/game/1", { method: "OPTIONS" }));
expect(response.status).toBe(204);
expect(response.headers.get("Access-Control-Allow-Origin")).toBe("https://fristy.net");
expect(response.headers.get("Access-Control-Allow-Origin")).toBe("https://fristy.dev");
expect(response.headers.get("Access-Control-Allow-Methods")).toBe("GET, OPTIONS");
});
it("rejects foreign origins", () => {
const response = proxy(apiRequest("/api/game/1", { origin: "https://evil.test" }));
expect(response.status).toBe(403);
expect(response.headers.get("Access-Control-Allow-Origin")).toBe("https://fristy.net");
expect(response.headers.get("Access-Control-Allow-Origin")).toBe("https://fristy.dev");
});
it("passes same-origin API requests with CORS headers", () => {
const response = proxy(apiRequest("/api/game/1"));
expect(response.headers.get("Access-Control-Allow-Origin")).toBe("https://fristy.net");
expect(response.headers.get("Access-Control-Allow-Origin")).toBe("https://fristy.dev");
});
});
@@ -57,7 +57,7 @@ describe("proxy rate limit", () => {
const limited = proxy(ipRequest("10.0.0.2"));
expect(limited.status).toBe(429);
expect(limited.headers.get("Retry-After")).toBe("60");
expect(limited.headers.get("Access-Control-Allow-Origin")).toBe("https://fristy.net");
expect(limited.headers.get("Access-Control-Allow-Origin")).toBe("https://fristy.dev");
await expect(limited.json()).resolves.toEqual({ error: "Too many requests" });
});