Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

fix(test): assert the untouched GET properly

Mauriceeaace6ada4ee
diff --git a/server/tests/unit/utils/ssrfGuard.test.ts b/server/tests/unit/utils/ssrfGuard.test.ts
index ad4f0ef0d..f75600a0f 100644
--- a/server/tests/unit/utils/ssrfGuard.test.ts
+++ b/server/tests/unit/utils/ssrfGuard.test.ts
@@ -431,7 +431,10 @@ describe('safeFetchFollow (manual per-hop redirect SSRF)', () => {
it('leaves a GET alone on a 301', async () => {
const mockFetch = twoHops('https://start.example/b', 301);
await safeFetchFollow('https://start.example/a', { headers: { 'User-Agent': 'TREK' } });
- expect(mockFetch.mock.calls[1][1]).toMatchObject({ method: undefined });
+ // No downgrade to apply: the request was already a GET, so the init keeps
+ // its shape and the caller's own header rides along.
+ expect((mockFetch.mock.calls[1][1] as RequestInit).method).toBeUndefined();
+ expect((mockFetch.mock.calls[1][1] as RequestInit).body).toBeUndefined();
expect(headerOf(mockFetch.mock.calls[1], 'user-agent')).toBe('TREK');
});