Skip to content

x402-lint reads the Payment-Required header before the body - #103

Merged
holistis merged 1 commit into
mainfrom
fix-x402-lint-reads-header
Oct 24, 2026
Merged

holistis merged 1 commit into
mainfrom
fix-x402-lint-reads-header

Conversation

@holistis

Copy link
Copy Markdown
Owner

x402 v2 sellers keep their requirements in the Payment-Required header and often answer with a body of {}. x402-lint read only the body, so it called a working v2 endpoint schema-invalid. Measured on 2026-10-24 against our own live paid route (api.tokenizen.nl/api/paid/verify-ownership), both with the library and with the hosted tool at x402-lint.tokenizen.nl: 'x402Version: Invalid discriminator value'.

The header is now read first, the body is the fallback, and the report says which one it used (new optional field source). Four new tests, red on the old code and green now; the existing tests are unchanged. README has an erratum. Version bumped to 0.1.1; publishing and redeploying the hosted service are separate steps.

An x402 v2 seller keeps its requirements in the Payment-Required header and often answers with a
body of {}. Reading only the body made this tool call a working v2 endpoint schema-invalid
(measured 2026-10-24 against our own live paid route: 'x402Version: Invalid discriminator value'),
and the hosted tool at x402-lint.tokenizen.nl did the same.

The header is now read first (base64 JSON or plain JSON), the body is the fallback, and the report
says which one was used (new optional field source). Four new tests, red on the old code, green now.
README gets an erratum. Version 0.1.1; publishing it is a separate step.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
tokenizen d5afc0e Commit Preview URL

Branch Preview URL
Oct 24 2026, 11:32 AM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
tokenizen-website d5afc0e Commit Preview URL

Branch Preview URL
Oct 24 2026, 11:33 AM

@holistis
holistis merged commit a08c04a into main Oct 24, 2026
6 checks passed
@holistis
holistis deleted the fix-x402-lint-reads-header branch October 24, 2026 11:33
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.

1 participant