fix(api): support custom headers in pup api - #749
Merged
jack-edmonds-dd merged 2 commits intoAug 21, 2026
Conversation
`pup api` advertises a repeatable -H flag, but Accept and Content-Type were applied as JSON defaults before the user's headers. reqwest's `header()` appends rather than replaces, so both values rode the request and the server negotiated against the wrong one, leaving `pup api` unable to reach any endpoint that does not speak JSON. - Parse -H before applying defaults; skip each default when the caller supplied that header, matched case-insensitively - Leave User-Agent non-overridable, since audit logs attribute writes by it Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
andyjmorgan
force-pushed
the
fix/api-header-override
branch
from
August 20, 2026 09:49
10d919d to
73af031
Compare
jack-edmonds-dd
approved these changes
Aug 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
We wish to add enhanced markdown functionality to the notebook tooling. To do so we need
pup apito support custom headers, which today are silently ignored forAcceptandContent-Type:reqwest's
header()appends rather than replaces, and pup set its JSON defaults before applying-H, so both values rode the request.Changes
-Hbefore applying defaults; skip each default when the caller supplied that header (case-insensitive).User-Agentstays non-overridable — audit logs attribute writes by it.Testing
AcceptandContent-Typeoverrides, mixed-case header names, and defaults still applying when no-His passed.Accept: text/markdownreturnstext/markdown; charset=utf-8;Content-Type: text/markdownreturns 201, previously 415.Known gaps
-Hfor the same header sends both values — expected for a raw passthrough.AcceptandContent-Typehad hardcoded defaults, so only those are affected.