Repository navigation
feat: a request sends Accept, the media types its responses declare - #86
Merged
Merged
Conversation
Each request now says what it accepts: the media types of its operation's responses, each once, in their order, such as application/json, or nothing where no response has a body. A recording made with Accept matches it, and go-api-libs/api's replay allows it where a recording made before lacks it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019QCb1AfnATvpBQCH3PrX7Y
go-api-libs/api#11 replays an Accept a recording lacks, through MarkRosemaker/cassette#7's OptionalHeaders: the generated packages' tests replay their recordings, made without Accept, with it. Until both merge, they are pinned to their commits. README.md follows README/features.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019QCb1AfnATvpBQCH3PrX7Y
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019QCb1AfnATvpBQCH3PrX7Y
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.
Each request now says what it accepts:
Acceptlists the media types its operation's responses declare, each once, in their order. It'sapplication/jsonfor most, orapplication/json, application/problem+jsonwhere an error response declares its own. Where no response has a body, nothing is sent.This came from go-api-libs/ibkr. Its newest recording was made by a tool that sends
Accept: application/json, and the generated client sent none, so replay failed. Rather than ignore the header, the client now sends what the spec says it accepts. A recording made withAcceptchecks it against that.Changes
ir.Operation.Accept()builds the header, andclient.gen.go.tmplsends it besideUser-Agent.Acceptlines and nothing else:application/json, plus onetext/plainand oneapplication/pdf, as those operations' responses declare.TestOperation_Acceptcovers what the golden files don't: two media types, a repeated one, and a response without a body.README/features.mddescribes it.Replaycompares a recordedAcceptand allows one a recording lacks, so the generated packages' tests replay their recordings, made withoutAccept.make readypasses.🤖 Generated with Claude Code
https://claude.ai/code/session_019QCb1AfnATvpBQCH3PrX7Y