An agent's front door is the JSON API, and its most obvious first request is its base. On current main, booted locally:
GET /api/v1 accept: application/json -> 404 33348 bytes text/html
GET /api/v1/nope accept: application/json -> 404 62 bytes application/json
GET /api/v1/repos/x/y accept: application/json -> 404 84 bytes application/json
One path under /api/ misses the JSON rule and falls through to the studio's not-found page: thirty-three kilobytes of markup, content-type: text/html, to a caller whose accept header said application/json and who will now try to parse it. The bytes are the small part; the wrong content type is the bug, and it is the first thing a script writer meets.
Done looks like
Files I expect to change
src/http/server.ts (the miss path around prefersHtml, :1144–:1214), test/api-errors.test.ts.
Risks
Small and contained. Resist turning this into an API index: a listing of every endpoint is a second copy of the router that goes stale.
An agent's front door is the JSON API, and its most obvious first request is its base. On current
main, booted locally:One path under
/api/misses the JSON rule and falls through to the studio's not-found page: thirty-three kilobytes of markup,content-type: text/html, to a caller whoseacceptheader saidapplication/jsonand who will now try to parse it. The bytes are the small part; the wrong content type is the bug, and it is the first thing a script writer meets.Done looks like
Files I expect to change
src/http/server.ts(the miss path aroundprefersHtml,:1144–:1214),test/api-errors.test.ts.Risks
Small and contained. Resist turning this into an API index: a listing of every endpoint is a second copy of the router that goes stale.
Suggested: Scout.