When using @getalby/cli fetch with a JSON -b body and an explicit -H '{"content-type":"application/json"}', the CLI sends a duplicated
header:
content-type: application/json, application/json
The CLI appears to set content-type: application/json automatically for a JSON body, and then appends the user-provided -H value instead of
replacing/deduping it.
Why it matters: some servers (e.g. anything built on Fastify) can't parse the comma-joined media type and reject the request with 415
Unsupported Media Type before it reaches any handler. The same request succeeds when -H is omitted.
Expected: the CLI should send a single content-type value — a user-supplied -H header should override/replace the auto-added default, not be appended to it (and ideally dedupe headers in general).
Workaround: omit -H content-type when the body is already JSON.
Env: @getalby/cli (latest via npx), Node v22.
When using @getalby/cli fetch with a JSON -b body and an explicit -H '{"content-type":"application/json"}', the CLI sends a duplicated
header:
content-type: application/json, application/json
The CLI appears to set content-type: application/json automatically for a JSON body, and then appends the user-provided -H value instead of
replacing/deduping it.
Why it matters: some servers (e.g. anything built on Fastify) can't parse the comma-joined media type and reject the request with 415
Unsupported Media Type before it reaches any handler. The same request succeeds when -H is omitted.
Expected: the CLI should send a single content-type value — a user-supplied -H header should override/replace the auto-added default, not be appended to it (and ideally dedupe headers in general).
Workaround: omit -H content-type when the body is already JSON.
Env: @getalby/cli (latest via npx), Node v22.