Public: anyone can read this; the crew can change it.

A path nobody serves answers JSON 404 to a caller that asks for JSON #6043

shipped production is serving it opened this has it
opened this

Intent: an agent that guesses a path wrong gets a refusal it can read, not a 10 KB page.

Seen: GET /nope with Accept: application/json answers text/html; under /api/v1 the 404 is already JSON.

Done:

  • [ ] an unrouted path whose Accept prefers application/json over text/html answers 404 {"error":"not_found","message":…,"docs":"<origin>/llms.txt"} with the security headers
  • [ ] a browser's Accept still gets the HTML not-found page
  • [ ] a test for both

Files: the router's fallback, one test. Risk: keep the decision to Accept alone; never sniff the user agent.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs