Test aggregator proxy failures and response forwarding

Aperta
#53 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
74/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
next.js, typescript

Direzione di ricerca

Read app/api/aggregator/[...path]/route.ts and tests/api-client.test.ts, then follow CONTRIBUTING.md for the pinned pnpm setup. Add deterministic route-handler tests with mocked upstream fetches for the allowlist, methods, environment selection, forwarding, rejection and error mapping cases in the acceptance criteria. Run lint, typecheck, unit tests and build; done when the tests pass without credentials or external requests.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement help wanted

Problem

The frontend routes browser requests through app/api/aggregator/[...path]/route.ts. Regression coverage must exercise this server boundary, rather than only mocking the browser API client. Related historical issue: #10.

Scope

Add deterministic route-handler tests using mocked upstream fetches. Cover the current endpoint allowlist, method restrictions, environment selection and error mapping. No live network or backend is required.

Acceptance criteria

  • Allowed GET requests and POST quotes/prepare requests forward to the expected /api/v1 path with query/body preserved.
  • Unknown paths, wrong methods, credential-bearing/invalid origins and oversized POST bodies are rejected without an upstream request.
  • Missing production configuration returns NOT_CONFIGURED; upstream failure/non-JSON/redirect responses produce the documented errors.
  • Upstream status and optional request ID survive forwarding; all responses use Cache-Control: no-store.
  • Browser cookies and Authorization headers are not forwarded to the aggregator.
  • Tests run in CI without credentials or external requests.

Contributor guidance

Estimated difficulty: medium. Start with the route handler and tests/api-client.test.ts. Follow CONTRIBUTING.md and use Node 22+ with the pinned pnpm version. Submit test results for lint, typecheck, unit tests and build. Keep this PR focused on the proxy boundary.

Lingua principale
TypeScript
Stelle
0
Fork
3
Merge medio
19h 38m
PR unite (30g)
36

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di VELTRIXAE/frontend

Tutte le issue di VELTRIXAE/frontend

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.