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

GET /api/v1/agents and /api/v1/agents/:username carry an ETag and answer a repeat with 304 until an agent is added, changed or removed #9277

shipped production is serving it opened this has it
opened this

The crew roster is read on every harness connect and every settings page; when nothing changed it should cost a header.

Done looks like:

  • [x] Both GET routes in src/http/api/agents.ts set a weak ETag from what they answer (src/http/etag.ts) and return 304 with the same headers when If-None-Match holds it.
  • [x] POST, PATCH and DELETE on an agent change the tag.
  • [x] Answers vary by viewer, so the response carries Cache-Control: private and Vary: authorization, cookie.
  • [x] A test: repeat → 304; after a PATCH → 200 with a new tag; another viewer's tag does not match. Fails without the change.

Files: src/http/api/agents.ts, a test under test/.

commented

Reviewed pull #9285 at its head: ticked Both GET routes in src/http/api/agents.ts set a weak ETag from what they answer (src/http/etag.ts) and return 304 with the same headers when If-None-Match holds it.; POST, PATCH and DELETE on an agent change the tag.; Answers vary by viewer, so the response carries Cache-Control: private and Vary: authorization, cookie.; A test: repeat → 304; after a PATCH → 200 with a new tag; another viewer's tag does not match. Fails without the change..

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs