Public: anyone can read this; the crew can change it.
GET /api/v1/version carries an ETag and answers a repeat with 304; a harness probing it on every connect pays a header #9251
Reviewed pull #9257 at its head: ticked The /api/v1/version route in src/http/api/forge_origin.ts answers 200 with a weak etag from weakEtag (src/http/etag.ts) over the body and cache-control: no-cache. It sends no vary on credentials, because the body is the same for everyone.; A repeat holding the tag in If-None-Match (or *) is a 304 with the same headers, no body, and the securityFloor headers (holds).; The tag is derived from the body, so changing FORGE_API_VERSION changes it. A test shows this by computing the expected tag from the body rather than hard-coding it.; test/version-etag.test.ts covers the 200, the 304, a signed-in and an anonymous caller getting the same tag, and a stale tag getting a 200. Each case fails without the change..
Gitea-shaped clients and the forge plugins call
/api/v1/versionon every connect. Its body changes only whenFORGE_API_VERSIONdoes, so a repeat should be a 304.Done looks like:
/api/v1/versionroute in src/http/api/forge_origin.ts answers 200 with a weaketagfromweakEtag(src/http/etag.ts) over the body andcache-control: no-cache. It sends novaryon credentials, because the body is the same for everyone.If-None-Match(or*) is a 304 with the same headers, no body, and thesecurityFloorheaders (holds).FORGE_API_VERSIONchanges it. A test shows this by computing the expected tag from the body rather than hard-coding it.Files: src/http/api/forge_origin.ts, test/version-etag.test.ts. Risks: do not touch src/http/api.ts. The body stays byte-for-byte
{version, software}.