Repository navigation
feat: OptionalHeaders matches a header recordings may lack - #7
Merged
Merged
Conversation
A client that begins to send a header, as go-api-libs' clients are to send Accept, would no longer match the recordings made before. OptionalHeaders names headers compared where a recording has them and allowed where it does not, as OptionalAuthorization does for credentials. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019QCb1AfnATvpBQCH3PrX7Y
MarkRosemaker
pushed a commit
to go-api-libs/api
that referenced
this pull request
Nov 25, 2026
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
This was referenced Nov 25, 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.
go-api-libs' generated clients are to send
Acceptwith the media types each operation's responses declare. Recordings made before don't have it, and stay as recorded. WithCompareHeaders, a request that sendsAcceptwould no longer match them.OptionalHeaders(names...)is a newMatchOption, used besideCompareHeaders. A header it names:OptionalAuthorizationalready treats credentials this way.Test: a
TestReplaycase with/arecorded withAccept: application/jsonand/brecorded without./adoesn't matchtext/htmlor a missingAccept, and does matchapplication/json./bmatches a request that sendsAccept.make readypasses.Next: go-api-libs/api's
ReplayusesOptionalHeaders("Accept")(go-api-libs/api#11), and openapi-codegen's clients sendAccept.Generated by Claude Code