infra stuff in gleam

atproto_codegen: PostBits procedures hardcode the lexicon's literal encoding as the Content-Type #35

Open mokkenstorm.dev
Open opened by mokkenstorm.dev

For procedures with a binary input (com.atproto.repo.uploadBlob declares input encoding /), the generated function always sends the literal lexicon string as the Content-Type header, because xrpc_client.gleam's PostBits case bakes encoding_of(m.input) directly into the call.

So repo_upload_blob sends Content-Type: / for every upload, and the caller has no way to pass the real per-call mimetype (image/jpeg, image/png, ...) even though the receiving PDS uses it for blob mimetype validation. This made the generated uploadBlob unusable for at-record's cover uploads; the hand-written upload_blob(mime_type: String) stayed.

Suggestion: when the declared encoding is a wildcard, take the mimetype as a function parameter; when it is concrete, keep it hardcoded (or still allow an override).

Sign up or Sign in to add to the discussion.