Serve the format auto, chosen from the Accept header (closes #88) #220

Merged
clawbot merged 2 commits from issue-88-format-auto into next 2026-10-05 05:24:51 +02:00
2 Commits
Author SHA1 Message Date
clawbot 9a5ef06c80 Serve the format auto, chosen from the Accept header (closes #88)
check / check (push) Failing after 2s
auto is a format in the /v1/image/ path, an encrypted URL's token and
the generator page. Once the signature or token is checked, pixa
chooses AVIF when Accept names image/avif, else WebP when it names
image/webp, else JPEG when the most specific of image/jpeg, image/* and
*/* allows it or Accept is absent. q=0 refuses a format; a header
allowing none of the three answers 406, one that does not parse 400.
The signature and token cover auto itself; the cache key and ETag use
the chosen format. Answers from then on carry Vary: Accept.

Model: opus-5-5
2026-10-05 02:42:58 +00:00
clawbot 39a647b6c5 Add failing tests for the format auto
Tests for #88, before the change:
the format chosen for each Accept header (AVIF-capable, WebP-only,
neither, wildcard only, absent, q=0 on AVIF, malformed), both image
routes serving an auto URL in the chosen format with Vary: Accept, also
on HEAD and 304, the signature covering auto rather than the chosen
format, each chosen format cached apart, and Vary: Accept next to the
CORS middleware's Vary: Origin. They do not compile yet: FormatAuto and
formatForAccept do not exist.

Model: opus-5-5
2026-10-05 02:42:58 +00:00