fix(examples): run HTTP demos against local demo server - #689
Open
Kewe63 wants to merge 1 commit into
Open
Conversation
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
Fixes #88
The HTTP examples currently rely on
https://x402-demo.sapiom.ai, but that public demo host can return Cloudflare 403s and make the examples fail before users can verify the SDK integration.This PR makes the axios, fetch, and node-http examples self-contained by running them against a local demo server by default.
Changes
examples/local-demo-server.mjswith the endpoint shapes used by the HTTP examples:GET /api/public/timeGET /api/public/statusGET /api/crm/customersPOST /api/smsPOST /api/campaigns/analyticsexamples/run-local-demo.mjsto start the local server, setDUMMY_SERVER_URL=http://localhost:3101, run the selected example script, and shut the server down.npm start,npm run free, andnpm run fullscripts to use the local demo helper..env.exampleand README docs so the broken public demo host is no longer the default.x402-demo.sapiom.ai403s.How to Test
✅ All passed locally.
Compatibility
DUMMY_SERVER_URLto point at another compatible server.Checklist
Risk & Impact
Low. Example-only change — no SDK code, API surface, or dependencies are touched. Users who already override
DUMMY_SERVER_URLare unaffected; the change only alters the default target for the HTTP examples.Type: 🐛 Bug fix
Fixes: #88