Skip to content

fix: replay compares a recorded Accept, and allows one a recording lacks - #11

Merged
MarkRosemaker merged 4 commits into
masterfrom
fix/replay-ignore-accept
Nov 25, 2026
Merged

MarkRosemaker merged 4 commits into
masterfrom
fix/replay-ignore-accept

Conversation

@MarkRosemaker

@MarkRosemaker MarkRosemaker commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

go-api-libs/ibkr's newest recording, GET /iserver/accounts, was made by a tool that sends Accept: application/json. ibkr's generated client sends no Accept, so its replay test fails:

ListTradableAccounts: Get "https://localhost:5000/v1/api/iserver/accounts": interaction #5: got headers map[], want map[Accept:[application/json]]

Rather than ignore Accept, generated clients are to send it: openapi-codegen will send the media types an operation's responses declare (MarkRosemaker/openapi-codegen#86). Replay therefore:

  • compares Accept where a recording has it, so ibkr's recording checks that its client accepts application/json;
  • allows it where a recording lacks it, as every recording made before clients sent it does.

It does both through cassette's OptionalHeaders("Accept"), from MarkRosemaker/cassette#7, which has merged; cassette is bumped to its main. User-Agent is still ignored, since it names whatever tool made the recording. The doc comment says both.

Test: TestReplay's first case records GET /a with Accept: application/json and calls it with the same, and calls POST /q, recorded without Accept, with one.

make ready passes.

🤖 Generated with Claude Code

https://claude.ai/code/session_019QCb1AfnATvpBQCH3PrX7Y

Accept, like User-Agent, says what tool made a recording, not what a call
asks for: go-api-libs/ibkr's newest recording was made by a tool sending
Accept: application/json, which its generated client does not send, so the
replay failed. Replay now compares headers but those two.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019QCb1AfnATvpBQCH3PrX7Y
Rather than ignoring Accept, Replay compares it where the recording has it,
and allows it where a recording made before clients sent it lacks it, through
cassette's OptionalHeaders. A recording made with Accept: application/json,
as go-api-libs/ibkr's newest, then matches a client that sends it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019QCb1AfnATvpBQCH3PrX7Y
MarkRosemaker/cassette#7 adds the OptionalHeaders Replay now uses; until it
merges, cassette is pinned to its commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019QCb1AfnATvpBQCH3PrX7Y
@MarkRosemaker MarkRosemaker changed the title fix: replay ignores a recording's Accept header fix: replay compares a recorded Accept, and allows one a recording lacks Nov 25, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019QCb1AfnATvpBQCH3PrX7Y
@MarkRosemaker
MarkRosemaker merged commit 0f50725 into master Nov 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants