Repository navigation
Example: a Transport over axios, run through the conformance suite - #64
Merged
Merged
Conversation
createAxiosTransport is the SDK's Transport over an axios instance; adapterFor makes the suite's server axios's network, so the nine checks exercise axios itself. axios is a dev dependency for this example only. AGENTS.md names client.search and client.deleted among the reads. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Rgicmffzzwb2CzyeDSEhBm
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.
One commit. Nothing in the published package changes:
examples/is not shipped, and axios is a dev dependency of the repository, used by this example alone. The package still has no runtime dependency.What it adds
examples/11-axios-transport.ts, for an app that already talks HTTP through an axios instance and wants the SDK to use the same one. Two parts, each meant to be copied:createAxiosTransport(http): the SDK'sTransportover an axios instance whosebaseURLis the Agility instance. It sends a body in the shape the SDK's rules give it (not axios's own guess), reads the response as asked, reports a refusal withapiErrorFromResponseso its errors are word for word the built-in transport's, and maps a cancel, a lost connection and a timeout toABORTED,NETWORK_ERRORandTIMEOUT.adapterFor(server): an axios adapter that makes the conformance suite's server axios's network, so the checks exercise axios itself (its header handling, its URL building,validateStatus) rather than a mock of it. It settles the response itself byvalidateStatus; without that, a 304 and a refusal would pass the suite for the wrong reason.The example then runs
transportConformanceagainst the transport and prints the count. In a test file the last lines becomefor (const check of checks) it(check.name, check.run).The adapter is a consumer's, contributed after the suite caught a real bug in that consumer's own axios transport on its first run (an empty body under
responseType: "json"must resolveundefined). The transport here is written for this example.Also:
AGENTS.mdnamesclient.searchandclient.deletedamong the client's reads, which the alpha.9 pull request did not add.Things a reviewer should know
publicTree,layersand the packaging tests are unaffected, andpackage.json'sfilesstill shipsdistand the changelog only.TIMEOUTso the client's resend rule recognises it.Verification
npm run verify: 249 unit tests in 32 files, all passing; the type-check compiles the example against the source.node examples/11-axios-transport.ts: 9 of 9 conformance checks pass (axios 1.21.1).Generated by Claude Code