Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

fix: ensure credential-less discovery probes receive valid 402 challenges

fudjia62e136796ffd
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c540cbec3..9a046bafc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,8 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
## 2026-07-12
- **Agent discovery fixed: six paid endpoints were invisible to x402 scanners** — The machine-readable catalog at /openapi.json — what AI agents and x402 scanners like x402scan and AgentCash read to find and pay for three.ws APIs — had six paid endpoints (agent bouncer, verifiable vanity keys, crypto intel, cosmetic purchase, animation download, club cover) accidentally buried inside another entry, making them undiscoverable. All 61 payable routes now list correctly and the document passes the AgentCash discovery validator. The Permit2 gasless-payment demo is now only advertised when its settlement lane is actually live, so agents are never quoted a payment path that can't settle. (`/openapi.json`) `[fix, improvement]`
+- **Oversized x402 payment headers fixed** — Three paid endpoints (vanity, pump launch, agent reputation) mirrored their entire payment challenge — schemas, signed offers and all — into a single HTTP header that grew past 16 KB, the point where proxies and many clients drop or fail to parse the response. The header mirror is now capped at 8 KB: it slims down or steps aside when the challenge is large, while the response body always carries the complete challenge. Payment tooling that reads only headers still gets everything it needs to pay. `[fix]`
+- **x402 registration probes now always get a real payment challenge** — Payment directories like x402scan verify an endpoint by poking it without paying and expecting the HTTP 402 payment challenge back. A July registration run rejected 33 three.ws endpoints because probes were answered with the wrong thing: method or input mistakes returned plain errors before the challenge, and per-item priced endpoints (asset downloads, marketplace skills, fact checks) demanded a valid item id before quoting a price. Now any credential-less request on a paid route receives the full 402 challenge — wrong method, missing id, or empty body included — while real paying callers keep strict validation before any money moves. The free crypto-data endpoints under /api/v1/x are now correctly advertised as free in /openapi.json instead of failing paid-endpoint probes, so agents see them for what they are: no-signup data with a pay-as-you-go overflow lane. (`/openapi.json`) `[fix, improvement]`
## 2026-07-11
diff --git a/api/_lib/x402-paid-endpoint.js b/api/_lib/x402-paid-endpoint.js
index 3c42e96c9..6f72c8d16 100644
--- a/api/_lib/x402-paid-endpoint.js
+++ b/api/_lib/x402-paid-endpoint.js
@@ -368,7 +368,21 @@ export function paidEndpoint(spec) {
const requestStartTime = Date.now();
if (cors(req, res, { methods: allowMethods, origins: '*' })) return;
const isHead = req.method === 'HEAD' && httpMethod === 'GET';
- if (req.method !== httpMethod && !isHead) {
+ // Discovery probes (x402scan, 402index, agent crawlers) hit paid routes
+ // with whatever method they like and expect the 402 challenge — the
+ // x402 discovery spec treats runtime 402 behavior as the source of
+ // truth, and a 405 reads as "not an x402 endpoint". A request on the
+ // wrong method that carries NO payment or auth credentials can only
+ // ever want the challenge, so serve it; anything carrying credentials
+ // intended to redeem the resource still gets the strict 405.
+ const hasCredentials =
+ !!req.headers?.['x-payment'] ||
+ !!req.headers?.['payment-signature'] ||
+ !!req.headers?.['sign-in-with-x'] ||
+ !!req.headers?.authorization ||
+ !!req.headers?.['x-api-key'];
+ const challengeOnly = req.method !== httpMethod && !isHead && !hasCredentials;
+ if (req.method !== httpMethod && !isHead && hasCredentials) {
res.setHeader('allow', allowMethods);
return error(res, 405, 'method_not_allowed', `use ${httpMethod}`);
}
@@ -532,6 +546,14 @@ export function paidEndpoint(spec) {
...(service?.iconUrl ? { iconUrl: service.iconUrl } : {}),
};
+ // Credential-less request on the wrong method (see the 405 gate above):
+ // answer with the challenge and stop — there is nothing to redeem, so
+ // none of the bypass/SIWX/settlement paths below apply.
+ if (challengeOnly) {
+ res.setHeader('allow', allowMethods);
+ return await send402(res, challenge);
+ }
+
// USE-21: auth-hints fast path. If the endpoint declared OAuth/SIWX as
// payment alternatives and the request carries a valid Authorization
// Bearer or SIGN-IN-WITH-X header, bypass the payment dance entirely.
diff --git a/api/_lib/x402-spec.js b/api/_lib/x402-spec.js
index e6a420dfa..8f4cc1e80 100644
--- a/api/_lib/x402-spec.js
+++ b/api/_lib/x402-spec.js
@@ -1456,18 +1456,47 @@ export async function build402Body({
};
}
+// Ceiling for the base64 PAYMENT-REQUIRED header mirror. Node's default
+// http client limit is 16 KB for the ENTIRE header block, and x402scan's
+// registration probe flags any response whose headers exceed 16 KB
+// (HEADERS_OVERFLOW — "some clients will fail to parse this response").
+// Endpoints with rich bazaar schemas + per-accept signed offers were
+// emitting 11–17 KB headers, which the production LB then dropped entirely.
+// 8 KB leaves comfortable room for the ~0.5 KB of ordinary headers.
+const PAYMENT_REQUIRED_HEADER_MAX = 8 * 1024;
+
+// The base64 header value mirroring a 402 envelope — or a spec-valid slimmed
+// mirror ({x402Version, error, resource, accepts} without `extensions`, which
+// is where the bulk lives: bazaar schemas, signed offers, SIWX declarations)
+// when the full envelope would blow the header budget, or null when even the
+// slim form is too large (many-accept endpoints). Header-only readers still
+// get everything needed to pay (accepts is complete); the JSON body remains
+// the canonical, complete envelope per the v2 spec.
+export function paymentRequiredHeaderValue(body) {
+ const full = Buffer.from(JSON.stringify(body), 'utf8').toString('base64');
+ if (full.length <= PAYMENT_REQUIRED_HEADER_MAX) return full;
+ const { x402Version, error, resource, accepts } = body;
+ const slim = Buffer.from(
+ JSON.stringify({ x402Version, error, resource, accepts }),
+ 'utf8',
+ ).toString('base64');
+ return slim.length <= PAYMENT_REQUIRED_HEADER_MAX ? slim : null;
+}
+
export async function send402(res, opts = {}) {
res.statusCode = 402;
res.setHeader('content-type', 'application/json; charset=utf-8');
res.setHeader('cache-control', 'no-store');
// v2 spec: the full envelope ({x402Version, error, resource, accepts,
- // extensions}) ships in the response body. `@x402/fetch` and other SDK
- // clients read it from there. We ALSO base64-encode the same envelope as
- // the `PAYMENT-REQUIRED` HTTP header — agentic.market's Bazaar validator
- // pulls discovery off the header during its probe and rejects entries
- // where the two differ.
+ // extensions}) ships in the response body — that is the canonical read
+ // for `@x402/fetch` and other SDK clients. The `PAYMENT-REQUIRED` header
+ // carries a base64 mirror for header-only crawlers, capped by
+ // paymentRequiredHeaderValue() so the total header block stays parseable
+ // (oversized mirrors were silently dropped by the production LB and
+ // flagged by x402scan's registration probe).
const body = await build402Body(opts);
- res.setHeader('PAYMENT-REQUIRED', Buffer.from(JSON.stringify(body), 'utf8').toString('base64'));
+ const headerValue = paymentRequiredHeaderValue(body);
+ if (headerValue) res.setHeader('PAYMENT-REQUIRED', headerValue);
res.end(JSON.stringify(body));
}
diff --git a/api/_mcp/auth.js b/api/_mcp/auth.js
index 2b73f3c17..9334dda7b 100644
--- a/api/_mcp/auth.js
+++ b/api/_mcp/auth.js
@@ -5,6 +5,7 @@ import {
verifyPayment,
send402,
build402Body,
+ paymentRequiredHeaderValue,
resolveResourceUrl,
} from '../_lib/x402-spec.js';
import { sendX402Error } from './payments.js';
@@ -50,15 +51,21 @@ export function isMcpProtocolClient(req) {
// probe spin; a blanket 401 made x402 crawlers misclassify the endpoints.)
//
// Both shapes ship the x402 payment envelope in the body + PAYMENT-REQUIRED
-// header, and both carry WWW-Authenticate, so either kind of client can
-// recover from a mismatched guess.
+// header. WWW-Authenticate rides ONLY on the 401: on a 402 it would carry no
+// `Payment` challenge (we speak x402, not MPP/Tempo), and x402scan's audit
+// treats any WWW-Authenticate on a 402 as an MPP header and flags the missing
+// Payment challenge. A plain client that actually wants OAuth can still find
+// the metadata at /.well-known/oauth-protected-resource.
export async function sendAuthChallenge(res, { req, resourceUrl, requirements, challenge }) {
const resource = env.MCP_RESOURCE;
- res.statusCode = isMcpProtocolClient(req) ? 401 : 402;
- res.setHeader(
- 'www-authenticate',
- `Bearer resource_metadata=${quoteString(`${env.APP_ORIGIN}/.well-known/oauth-protected-resource`)}, resource=${quoteString(resource)}`,
- );
+ const isProtocolClient = isMcpProtocolClient(req);
+ res.statusCode = isProtocolClient ? 401 : 402;
+ if (isProtocolClient) {
+ res.setHeader(
+ 'www-authenticate',
+ `Bearer resource_metadata=${quoteString(`${env.APP_ORIGIN}/.well-known/oauth-protected-resource`)}, resource=${quoteString(resource)}`,
+ );
+ }
// `challenge` (optional) lets a dedicated MCP endpoint advertise its own
// service metadata + bazaar discovery in the 402 envelope (the Granite
// server at /api/ibm-mcp, the 3D Studio at /api/mcp-3d). Omitted →
@@ -66,7 +73,8 @@ export async function sendAuthChallenge(res, { req, resourceUrl, requirements, c
// build402Body is async (it signs per-accept offer receipts), so await it —
// stringifying the unresolved Promise shipped an empty `{}` envelope before.
const body = await build402Body({ resourceUrl, accepts: requirements, ...(challenge || {}) });
- res.setHeader('PAYMENT-REQUIRED', Buffer.from(JSON.stringify(body), 'utf8').toString('base64'));
+ const headerValue = paymentRequiredHeaderValue(body);
+ if (headerValue) res.setHeader('PAYMENT-REQUIRED', headerValue);
res.setHeader('content-type', 'application/json; charset=utf-8');
res.setHeader('cache-control', 'no-store');
res.end(JSON.stringify(body));
diff --git a/api/openapi-json.js b/api/openapi-json.js
index cb8f30a2f..aaab64bc5 100644
--- a/api/openapi-json.js
+++ b/api/openapi-json.js
@@ -59,7 +59,26 @@ function aggregatorPaths() {
summary: `${provider.name}: ${ep.summary}`,
description,
tags: ['Crypto API (aggregator)'],
- security: [{}, { bearerAuth: [] }, { apiKeyAuth: [] }],
+ // Free-tier endpoints declare `security: []` (explicitly public) and
+ // carry NO x-payment-info: discovery auditors (x402scan's crawler,
+ // @agentcash/discovery inferAuthMode) classify any operation with
+ // x-payment-info as "paid" and then require a 402 on a bare probe —
+ // but these answer a bare probe 200 from the free lane, so the paid
+ // classification got all 29 skipped as "no valid x402 response"
+ // during x402scan registration. Public + the billing prose above
+ // registers them as public endpoints; the x402 overage lane still
+ // exists at runtime and stays documented in `description`. Endpoints
+ // with no free tier ARE pay-first (bare probe → 402), so they keep
+ // structured x-payment-info (AgentCash) and the optional-auth modes.
+ ...(ep.free
+ ? { security: [] }
+ : {
+ security: [{}, { bearerAuth: [] }, { apiKeyAuth: [] }],
+ 'x-payment-info': {
+ price: { mode: 'fixed', currency: 'USD', amount: priceUsd },
+ protocols: X402_PROTOCOLS,
+ },
+ }),
responses: {
200: { description: 'Normalized upstream response, wrapped as { data, _meta }' },
400: { description: 'Missing or invalid parameter' },
@@ -67,13 +86,6 @@ function aggregatorPaths() {
404: { description: 'Unknown provider/endpoint pair' },
429: { description: 'Rate limited' },
},
- 'x-payment-info': {
- price: { mode: 'fixed', currency: 'USD', amount: priceUsd },
- protocols: X402_PROTOCOLS,
- note: ep.free
- ? `Free before payment: ${ep.free.perMin}/min, ${ep.free.perDay}/day per IP, no credentials required.`
- : undefined,
- },
};
if (ep.method === 'POST') {
diff --git a/api/v1/x/[...slug].js b/api/v1/x/[...slug].js
index 7db7c45ee..d9d351bcb 100644
--- a/api/v1/x/[...slug].js
+++ b/api/v1/x/[...slug].js
@@ -161,6 +161,20 @@ export default wrap(async (req, res) => {
const isHead = req.method === 'HEAD' && endpoint.method === 'GET';
if (req.method !== endpoint.method && !isHead) {
+ // Same probe-friendliness rule as api/_lib/x402-paid-endpoint.js: a
+ // wrong-method request carrying no payment or auth credentials is a
+ // discovery probe (x402scan, Bazaar validators) that wants the 402
+ // challenge, so hand it to the paid rail — its own method gate serves
+ // the challenge for exactly this case. Credentialed callers still get
+ // the strict 405.
+ const hasCredentials =
+ !!req.headers['x-payment'] ||
+ !!req.headers['payment-signature'] ||
+ !!req.headers['sign-in-with-x'] ||
+ !!req.headers.authorization ||
+ !!req.headers['x-api-key'] ||
+ (provider.byokHeader && !!req.headers[provider.byokHeader]);
+ if (!hasCredentials) return getPaidHandler(provider, endpoint)(req, res);
res.setHeader('allow', `${endpoint.method}, OPTIONS`);
return error(res, 405, 'method_not_allowed', `use ${endpoint.method}`);
}
diff --git a/api/x402/asset-download.js b/api/x402/asset-download.js
index 22c2c7ed6..a3d611a42 100644
--- a/api/x402/asset-download.js
+++ b/api/x402/asset-download.js
@@ -10,7 +10,8 @@
// real GLBs. The client fetches the file directly from R2 with the URL.
import { paidEndpoint } from '../_lib/x402-paid-endpoint.js';
-import { buildBazaarSchema } from '../_lib/x402-spec.js';
+import { buildBazaarSchema, paymentRequirements, send402 } from '../_lib/x402-spec.js';
+import { priceFor } from '../_lib/x402-prices.js';
import { withService } from '../_lib/x402/bazaar-helpers.js';
import { sql } from '../_lib/db.js';
import { presignGet } from '../_lib/r2.js';
@@ -126,12 +127,40 @@ function buildPayToOverride(asset) {
return Object.keys(out).length ? out : undefined;
}
+// Discovery probes (x402scan registration, Bazaar validators) hit the bare
+// route with no ?slug= and expect a valid 402 challenge, not a 400. Without a
+// slug there is no per-asset price, so this advertises the endpoint at a
+// representative default (env-overridable via X402_PRICE_ASSET_DOWNLOAD) with
+// the full bazaar schema. No money can settle against it: a paid retry still
+// needs ?slug=<slug> (the paymentPresent branches below keep their 400/404),
+// and an X-PAYMENT envelope is only an authorization — USDC moves at settle,
+// which this path never reaches.
+function sendDiscoveryChallenge(res, errText) {
+ const resourceUrl = `${env.APP_ORIGIN}${ROUTE}`;
+ return send402(res, {
+ resourceUrl,
+ accepts: paymentRequirements(resourceUrl, { amount: priceFor('asset-download', '1000000') }),
+ description: DESCRIPTION,
+ bazaar: BAZAAR,
+ error: errText,
+ serviceName: 'three.ws Asset Bazaar',
+ tags: ['3d', 'asset', 'glb', 'avatar', 'download'],
+ });
+}
+
// Per-asset paidEndpoint built on the fly. The slug picks the row, which
// dictates price + payout overrides + R2 key — everything else is shared.
export default async function handler(req, res) {
const slug = req.query?.slug ? String(req.query.slug).trim() : '';
+ const paymentPresent = Boolean(req.headers['x-payment'] || req.headers['payment-signature']);
if (!slug) {
- return error(res, 400, 'slug_required', 'query parameter "slug" is required');
+ if (paymentPresent) {
+ return error(res, 400, 'slug_required', 'query parameter "slug" is required');
+ }
+ return sendDiscoveryChallenge(
+ res,
+ 'query parameter "slug" is required — retry with ?slug=<slug> from the paid_assets catalog for that asset’s exact price',
+ );
}
let asset;
@@ -141,7 +170,13 @@ export default async function handler(req, res) {
return error(res, 502, 'paid_assets_lookup_failed', err.message);
}
if (!asset) {
- return error(res, 404, 'asset_not_found', `no paid_assets row with slug "${slug}"`);
+ if (paymentPresent) {
+ return error(res, 404, 'asset_not_found', `no paid_assets row with slug "${slug}"`);
+ }
+ return sendDiscoveryChallenge(
+ res,
+ `no paid_assets row with slug "${slug}" — browse /api/assets for available slugs`,
+ );
}
const inner = paidEndpoint({
diff --git a/api/x402/fact-check.js b/api/x402/fact-check.js
index 9f5df2ef7..0e103cf2d 100644
--- a/api/x402/fact-check.js
+++ b/api/x402/fact-check.js
@@ -502,13 +502,22 @@ export default wrap(async function handler(req, res) {
if (paymentPresent) return paidHandler()(req, res);
// Parse/validate against the boundary so genuinely broken input never
- // becomes a payment prompt or burns a free-quota slot.
+ // becomes a payment prompt or burns a free-quota slot: malformed JSON and
+ // a present-but-invalid claim stay hard 400s. The one exception is a
+ // well-formed body with NO claim at all — that is the shape discovery
+ // probes (x402scan's registration crawler POSTs `{}`) send, and registries
+ // require a valid 402 challenge on a bare probe. Those fall through to the
+ // paid rail, whose challenge carries the bazaar schema that tells the
+ // caller how to build a valid body. No quota is spent and nothing can
+ // settle here — a paid retry parses its body inside the handler, after
+ // verification, against the same validator.
let body;
try {
body = parseJsonBody(buf);
} catch (e) {
return error(res, e.status || 400, e.code || 'invalid_json', e.message);
}
+ if (body?.claim === undefined) return paidHandler()(req, res);
let parsed;
try {
parsed = parseFactCheckBody(body);
diff --git a/api/x402/skill-call.js b/api/x402/skill-call.js
index 77cc247ca..83b159a33 100644
--- a/api/x402/skill-call.js
+++ b/api/x402/skill-call.js
@@ -18,7 +18,7 @@
// /api/skills/:id.
import { paidEndpoint } from '../_lib/x402-paid-endpoint.js';
-import { buildBazaarSchema } from '../_lib/x402-spec.js';
+import { buildBazaarSchema, paymentRequirements, send402 } from '../_lib/x402-spec.js';
import { withService } from '../_lib/x402/bazaar-helpers.js';
import { priceFor } from '../_lib/x402-prices.js';
import { sql } from '../_lib/db.js';
@@ -129,10 +129,39 @@ function usdToAtomics(usd) {
return String(Math.max(1, Math.round(Number(usd) * 1_000_000)));
}
+// Discovery probes (x402scan registration, Bazaar validators) hit the bare
+// route with no ?skill= and expect a valid 402 challenge, not a 400. Without
+// a slug there is no per-skill price, so this advertises the endpoint at a
+// representative default (env-overridable via X402_PRICE_SKILL_CALL — the
+// per-skill env slugs are `skill-call-<slug>`, so the bare slug is free for
+// this) with the full bazaar schema. No money can settle against it: a paid
+// retry still needs ?skill=<slug> (the paymentPresent branches below keep
+// their 400/404), and an X-PAYMENT envelope is only an authorization — USDC
+// moves at settle, which this path never reaches.
+function sendDiscoveryChallenge(res, errText) {
+ const resourceUrl = `${env.APP_ORIGIN}${ROUTE}`;
+ return send402(res, {
+ resourceUrl,
+ accepts: paymentRequirements(resourceUrl, { amount: priceFor('skill-call', '10000') }),
+ description: DESCRIPTION,
+ bazaar: BAZAAR,
+ error: errText,
+ serviceName: 'three.ws Skill Call',
+ tags: ['skill', 'agent', 'tool', 'pay-per-call'],
+ });
+}
+
export default async function handler(req, res) {
const slug = req.query?.skill ? String(req.query.skill).trim() : '';
+ const paymentPresent = Boolean(req.headers['x-payment'] || req.headers['payment-signature']);
if (!slug) {
- return error(res, 400, 'skill_required', 'query parameter "skill" is required');
+ if (paymentPresent) {
+ return error(res, 400, 'skill_required', 'query parameter "skill" is required');
+ }
+ return sendDiscoveryChallenge(
+ res,
+ 'query parameter "skill" is required — retry with ?skill=<slug> from the marketplace catalog for that skill’s exact price',
+ );
}
let skill;
@@ -142,7 +171,13 @@ export default async function handler(req, res) {
return error(res, 502, 'skill_lookup_failed', err.message);
}
if (!skill) {
- return error(res, 404, 'skill_not_found', `no public skill with slug "${slug}"`);
+ if (paymentPresent) {
+ return error(res, 404, 'skill_not_found', `no public skill with slug "${slug}"`);
+ }
+ return sendDiscoveryChallenge(
+ res,
+ `no public skill with slug "${slug}" — browse /api/skills for available slugs`,
+ );
}
if (!(Number(skill.price_per_call_usd) > 0)) {
return error(
diff --git a/data/changelog.json b/data/changelog.json
index c19e24560..d4daa39fc 100644
--- a/data/changelog.json
+++ b/data/changelog.json
@@ -1,6 +1,14 @@
{
"$comment": "Curated changelog entries for three.ws — the editorial layer of the public changelog. New PAGE launches are tracked automatically via the `added` field in data/pages.json; this file is for everything else holders care about: improvements, fixes, SDK releases, trading/payments capabilities, security work. scripts/build-page-index.mjs merges both sources into CHANGELOG.md, public/changelog.json, and public/changelog.xml. Newest first. Allowed tags: feature, improvement, fix, sdk, infra, docs, security. `link` is optional and must be a live three.ws path.",
"entries": [
+ {
+ "date": "2026-07-12",
+ "title": "Oversized x402 payment headers fixed",
+ "summary": "Three paid endpoints (vanity, pump launch, agent reputation) mirrored their entire payment challenge — schemas, signed offers and all — into a single HTTP header that grew past 16 KB, the point where proxies and many clients drop or fail to parse the response. The header mirror is now capped at 8 KB: it slims down or steps aside when the challenge is large, while the response body always carries the complete challenge. Payment tooling that reads only headers still gets everything it needs to pay.",
+ "tags": [
+ "fix"
+ ]
+ },
{
"date": "2026-07-12",
"title": "Agent discovery fixed: six paid endpoints were invisible to x402 scanners",
@@ -11,6 +19,16 @@
],
"link": "/openapi.json"
},
+ {
+ "date": "2026-07-12",
+ "title": "x402 registration probes now always get a real payment challenge",
+ "summary": "Payment directories like x402scan verify an endpoint by poking it without paying and expecting the HTTP 402 payment challenge back. A July registration run rejected 33 three.ws endpoints because probes were answered with the wrong thing: method or input mistakes returned plain errors before the challenge, and per-item priced endpoints (asset downloads, marketplace skills, fact checks) demanded a valid item id before quoting a price. Now any credential-less request on a paid route receives the full 402 challenge — wrong method, missing id, or empty body included — while real paying callers keep strict validation before any money moves. The free crypto-data endpoints under /api/v1/x are now correctly advertised as free in /openapi.json instead of failing paid-endpoint probes, so agents see them for what they are: no-signup data with a pay-as-you-go overflow lane.",
+ "tags": [
+ "fix",
+ "improvement"
+ ],
+ "link": "/openapi.json"
+ },
{
"date": "2026-07-11",
"title": "The datapoint fabric: 480,000+ standalone paid endpoints",
@@ -13178,4 +13196,4 @@
"link": "/docs/agent-shell"
}
]
-}
\ No newline at end of file
+}
diff --git a/docs/ops/x402-discovery-listings.md b/docs/ops/x402-discovery-listings.md
index bdc606671..750c64072 100644
--- a/docs/ops/x402-discovery-listings.md
+++ b/docs/ops/x402-discovery-listings.md
@@ -179,6 +179,47 @@ CDP/x402 team. Not ERC-8004-based. Burden: none beyond section 2.
A2A agent card with the x402 extension — all generated from the service
catalog, never hand-maintained.
+## Registration log
+
+**2026-07-11 — x402scan registration (owner, SIWX signature): 23/23 resources
+registered** for origin three.ws; 2 stale resources auto-deprecated. The
+probe surfaced two classes of issue, fixed in code on 2026-07-12:
+
+- **Oversized `PAYMENT-REQUIRED` headers** (agent-reputation, pump-launch,
+ vanity — >16 KB with signed offers + bazaar schemas mirrored into the
+ header; the production LB dropped the header outright).
+ `paymentRequiredHeaderValue()` in `api/_lib/x402-spec.js` now caps the
+ mirror at 8 KB: full envelope when it fits, extensions-free slim envelope
+ when it doesn't, no header when even that overflows. The JSON body always
+ carries the complete envelope. This also clears the "no auth mode"
+ warnings on the same three resources — that was a side-effect of
+ x402scan's header-overflow fallback probe, which skips the OpenAPI merge.
+- **`/api/mcp` WWW-Authenticate warning**: x402scan audits any
+ WWW-Authenticate on a 402 as an MPP header and flags the missing
+ `Payment` challenge. We speak x402, not MPP/Tempo, so the 402 branch of
+ `api/_mcp/auth.js sendAuthChallenge()` no longer sends WWW-Authenticate
+ (the 401 OAuth branch keeps it).
+- **Skipped "unprotected" endpoints**: the 29 free-tier `/api/v1/x/*`
+ aggregator endpoints now declare `security: []` with no `x-payment-info`
+ in `/openapi.json` (the auditor classifies x-payment-info as paid and then
+ demands a 402 the free lane can't give) — they register as public
+ endpoints on the next probe. `skill-call`, `asset-download` (bare probes
+ hit input validation before the paywall) and `fact-check` (claim-less
+ probe body) now answer credential-less probes with a valid 402 challenge;
+ paying callers with bad input still get the strict 400/404. Wrong-method
+ credential-less probes get the challenge too (`x402-paid-endpoint.js`
+ method gate).
+- **`permit2-paid-demo` stays unregistered by design** until
+ `CDP_API_KEY_ID`/`CDP_API_KEY_SECRET` land on the Cloud Run service: its
+ 402 deliberately advertises only the Permit2 accept (USE-18 forces the
+ gasless path), which is empty without CDP creds. Those same creds are the
+ gate on Bazaar indexing (section 2) and Base settlement generally —
+ highest-leverage owner action on this whole page.
+
+After deploying challenge-shape changes, re-run the x402scan probe (Add API
+on <https://www.x402scan.com> for the three.ws origin, or per-resource
+re-registration) — it does not immediately re-crawl on its own.
+
## Sources
CDP Bazaar docs · Bazaar extension spec · x402 v2 spec · x402 v2 launch post ·
diff --git a/public/changelog.json b/public/changelog.json
index 5cf963da6..0433d10ca 100644
--- a/public/changelog.json
+++ b/public/changelog.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-07-12T02:09:06.437Z",
+ "generated_at": "2026-07-12T02:21:38.915Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json",
"site": {
"name": "three.ws",
@@ -17,6 +17,27 @@
"improvement"
]
},
+ {
+ "date": "2026-07-12",
+ "type": "update",
+ "title": "Oversized x402 payment headers fixed",
+ "summary": "Three paid endpoints (vanity, pump launch, agent reputation) mirrored their entire payment challenge — schemas, signed offers and all — into a single HTTP header that grew past 16 KB, the point where proxies and many clients drop or fail to parse the response. The header mirror is now capped at 8 KB: it slims down or steps aside when the challenge is large, while the response body always carries the complete challenge. Payment tooling that reads only headers still gets everything it needs to pay.",
+ "link": null,
+ "tags": [
+ "fix"
+ ]
+ },
+ {
+ "date": "2026-07-12",
+ "type": "update",
+ "title": "x402 registration probes now always get a real payment challenge",
+ "summary": "Payment directories like x402scan verify an endpoint by poking it without paying and expecting the HTTP 402 payment challenge back. A July registration run rejected 33 three.ws endpoints because probes were answered with the wrong thing: method or input mistakes returned plain errors before the challenge, and per-item priced endpoints (asset downloads, marketplace skills, fact checks) demanded a valid item id before quoting a price. Now any credential-less request on a paid route receives the full 402 challenge — wrong method, missing id, or empty body included — while real paying callers keep strict validation before any money moves. The free crypto-data endpoints under /api/v1/x are now correctly advertised as free in /openapi.json instead of failing paid-endpoint probes, so agents see them for what they are: no-signup data with a pay-as-you-go overflow lane.",
+ "link": "/openapi.json",
+ "tags": [
+ "fix",
+ "improvement"
+ ]
+ },
{
"date": "2026-07-11",
"type": "launch",
diff --git a/public/changelog.xml b/public/changelog.xml
index c7fca2af9..3518e937d 100644
--- a/public/changelog.xml
+++ b/public/changelog.xml
@@ -14,6 +14,22 @@
<category>fix</category>
<description>The machine-readable catalog at /openapi.json — what AI agents and x402 scanners like x402scan and AgentCash read to find and pay for three.ws APIs — had six paid endpoints (agent bouncer, verifiable vanity keys, crypto intel, cosmetic purchase, animation download, club cover) accidentally buried inside another entry, making them undiscoverable. All 61 payable routes now list correctly and the document passes the AgentCash discovery validator. The Permit2 gasless-payment demo is now only advertised when its settlement lane is actually live, so agents are never quoted a payment path that can't settle.</description>
</item>
+ <item>
+ <title>Oversized x402 payment headers fixed</title>
+ <link>https://three.ws/changelog</link>
+ <guid isPermaLink="false">2026-07-12:Oversized x402 payment headers fixed</guid>
+ <pubDate>Sun, 12 Jul 2026 12:00:00 GMT</pubDate>
+ <category>fix</category>
+ <description>Three paid endpoints (vanity, pump launch, agent reputation) mirrored their entire payment challenge — schemas, signed offers and all — into a single HTTP header that grew past 16 KB, the point where proxies and many clients drop or fail to parse the response. The header mirror is now capped at 8 KB: it slims down or steps aside when the challenge is large, while the response body always carries the complete challenge. Payment tooling that reads only headers still gets everything it needs to pay.</description>
+ </item>
+ <item>
+ <title>x402 registration probes now always get a real payment challenge</title>
+ <link>https://three.ws/openapi.json</link>
+ <guid isPermaLink="false">2026-07-12:x402 registration probes now always get a real payment challenge</guid>
+ <pubDate>Sun, 12 Jul 2026 12:00:00 GMT</pubDate>
+ <category>fix</category>
+ <description>Payment directories like x402scan verify an endpoint by poking it without paying and expecting the HTTP 402 payment challenge back. A July registration run rejected 33 three.ws endpoints because probes were answered with the wrong thing: method or input mistakes returned plain errors before the challenge, and per-item priced endpoints (asset downloads, marketplace skills, fact checks) demanded a valid item id before quoting a price. Now any credential-less request on a paid route receives the full 402 challenge — wrong method, missing id, or empty body included — while real paying callers keep strict validation before any money moves. The free crypto-data endpoints under /api/v1/x are now correctly advertised as free in /openapi.json instead of failing paid-endpoint probes, so agents see them for what they are: no-signup data with a pay-as-you-go overflow lane.</description>
+ </item>
<item>
<title>Dashboard · Billing &amp; Passes</title>
<link>https://three.ws/dashboard/billing</link>
diff --git a/public/features.json b/public/features.json
index 3755aceae..409ae6040 100644
--- a/public/features.json
+++ b/public/features.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-07-12T01:57:46.059Z",
+ "generated_at": "2026-07-12T02:21:38.902Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json",
"site": {
"name": "three.ws",
diff --git a/public/sitemap/index.html b/public/sitemap/index.html
index 7cf6417d6..204591662 100644
--- a/public/sitemap/index.html
+++ b/public/sitemap/index.html
@@ -56,25 +56,6 @@
.sm-brand img { width: 24px; height: 24px; border-radius: 5px; }
.sm-brand:hover { text-decoration: none; }
</style>
-
- <meta name="robots" content="index, follow, max-image-preview:large, max-snippet:-1">
- <meta property="og:type" content="website">
- <meta property="og:site_name" content="three.ws">
- <meta property="og:locale" content="en_US">
- <meta property="og:title" content="Sitemap · three.ws">
- <meta property="og:description" content="Human-readable index of every page on three.ws.">
- <meta property="og:url" content="https://three.ws/sitemap">
- <meta property="og:image" content="https://three.ws/api/page-og?s=main&amp;t=Sitemap&amp;d=Human-readable+index+of+every+page+on+three.ws.&amp;p=%2Fsitemap">
- <meta property="og:image:width" content="1200">
- <meta property="og:image:height" content="630">
- <meta property="og:image:type" content="image/png">
- <meta property="og:image:alt" content="Sitemap — three.ws">
- <meta name="twitter:card" content="summary_large_image">
- <meta name="twitter:site" content="@trythreews">
- <meta name="twitter:title" content="Sitemap · three.ws">
- <meta name="twitter:description" content="Human-readable index of every page on three.ws.">
- <meta name="twitter:image" content="https://three.ws/api/page-og?s=main&amp;t=Sitemap&amp;d=Human-readable+index+of+every+page+on+three.ws.&amp;p=%2Fsitemap">
- <script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"WebPage","name":"Sitemap","description":"Human-readable index of every page on three.ws.","url":"https://three.ws/sitemap","isPartOf":{"@type":"WebSite","name":"three.ws","url":"https://three.ws"},"primaryImageOfPage":"https://three.ws/api/page-og?s=main&t=Sitemap&d=Human-readable+index+of+every+page+on+three.ws.&p=%2Fsitemap"}]}</script>
</head>
<body>
<header class="sm-topbar">
diff --git a/tests/api/fact-check-v2.test.js b/tests/api/fact-check-v2.test.js
index cc945ff3c..d288a4e40 100644
--- a/tests/api/fact-check-v2.test.js
+++ b/tests/api/fact-check-v2.test.js
@@ -177,12 +177,23 @@ describe('POST /api/x402/fact-check — free daily lane', () => {
expect(res.json().lane).not.toBe('free');
});
- it('GET (or any non-POST) is left entirely to the paid rail\'s own method guard', async () => {
- const req = Readable.from([]);
- req.method = 'GET';
- req.url = '/api/x402/fact-check';
- req.headers = { ...freshIp() };
- const res = await callFactCheck(req);
- expect(res.statusCode).toBe(405);
+ it('GET (or any non-POST) is left entirely to the paid rail', async () => {
+ // Credential-less wrong-method requests are discovery probes and receive
+ // the 402 challenge (x402-paid-endpoint.js method gate); a request
+ // carrying payment/auth credentials still gets the strict 405.
+ const probe = Readable.from([]);
+ probe.method = 'GET';
+ probe.url = '/api/x402/fact-check';
+ probe.headers = { ...freshIp() };
+ const probeRes = await callFactCheck(probe);
+ expect(probeRes.statusCode).toBe(402);
+ expect(Array.isArray(probeRes.json().accepts)).toBe(true);
+
+ const paying = Readable.from([]);
+ paying.method = 'GET';
+ paying.url = '/api/x402/fact-check';
+ paying.headers = { 'x-payment': 'abc', ...freshIp() };
+ const payingRes = await callFactCheck(paying);
+ expect(payingRes.statusCode).toBe(405);
});
});
diff --git a/tests/api/mcp.test.js b/tests/api/mcp.test.js
index 51a29dddf..867ec627d 100644
--- a/tests/api/mcp.test.js
+++ b/tests/api/mcp.test.js
@@ -140,6 +140,9 @@ vi.mock('../../api/_lib/x402-spec.js', () => ({
extensions: { bazaar: { method: 'POST', bodyType: 'json' } },
};
}),
+ paymentRequiredHeaderValue: vi.fn((body) =>
+ Buffer.from(JSON.stringify(body), 'utf8').toString('base64'),
+ ),
resolveResourceUrl: vi.fn((req, path) => `https://app.test${path}`),
}));
diff --git a/tests/api/x402-spec.test.js b/tests/api/x402-spec.test.js
index e38ff7671..af42fad7c 100644
--- a/tests/api/x402-spec.test.js
+++ b/tests/api/x402-spec.test.js
@@ -511,6 +511,77 @@ describe('send402 PAYMENT-REQUIRED header', () => {
// Header and body must agree byte-for-byte to satisfy the validator.
expect(JSON.stringify(decoded)).toBe(JSON.stringify(body));
});
+
+ // Endpoints with rich bazaar schemas + per-accept signed offers were
+ // emitting 11–17 KB header mirrors; the production LB dropped them
+ // outright and x402scan flagged HEADERS_OVERFLOW on registration. The
+ // header is capped at 8 KB: full mirror when it fits, an extensions-free
+ // slim mirror when it doesn't, no header at all when even that overflows.
+ // The JSON body always carries the complete envelope.
+ describe('paymentRequiredHeaderValue cap', () => {
+ function envelopeWithExtensions(extBytes, acceptsCount = 1) {
+ return {
+ x402Version: 2,
+ error: 'X-PAYMENT header is required',
+ resource: { url: 'https://three.ws/api/x402/foo', description: 'demo', mimeType: 'application/json' },
+ accepts: Array.from({ length: acceptsCount }, (_, i) => ({
+ scheme: 'exact',
+ network: 'eip155:8453',
+ amount: '1000',
+ payTo: `0x000000000000000000000000000000000000000${i}`,
+ asset: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
+ })),
+ extensions: { bazaar: { blob: 'x'.repeat(extBytes) } },
+ };
+ }
+
+ it('mirrors the full envelope when it fits', async () => {
+ const { paymentRequiredHeaderValue } = await loadSpec();
+ const body = envelopeWithExtensions(100);
+ const header = paymentRequiredHeaderValue(body);
+ expect(JSON.parse(Buffer.from(header, 'base64').toString('utf8'))).toEqual(body);
+ });
+
+ it('drops extensions when the full mirror exceeds 8 KB, keeping a payable slim envelope', async () => {
+ const { paymentRequiredHeaderValue } = await loadSpec();
+ const body = envelopeWithExtensions(20_000);
+ const header = paymentRequiredHeaderValue(body);
+ expect(header.length).toBeLessThanOrEqual(8 * 1024);
+ const decoded = JSON.parse(Buffer.from(header, 'base64').toString('utf8'));
+ expect(decoded.extensions).toBeUndefined();
+ // Everything a header-only payer needs survives.
+ expect(decoded.x402Version).toBe(2);
+ expect(decoded.accepts).toEqual(body.accepts);
+ expect(decoded.resource).toEqual(body.resource);
+ });
+
+ it('returns null when even the slim envelope overflows', async () => {
+ const { paymentRequiredHeaderValue } = await loadSpec();
+ const body = envelopeWithExtensions(100, 80); // ~80 accepts ≫ 8 KB alone
+ expect(paymentRequiredHeaderValue(body)).toBeNull();
+ });
+
+ it('send402 omits the header instead of emitting an oversized one', async () => {
+ const { send402 } = await loadSpec();
+ const res = makeRes();
+ await send402(res, {
+ resourceUrl: 'https://three.ws/api/x402/foo',
+ accepts: Array.from({ length: 80 }, (_, i) => ({
+ scheme: 'exact',
+ network: 'eip155:8453',
+ amount: '1000',
+ payTo: `0x000000000000000000000000000000000000000${i}`,
+ asset: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
+ })),
+ description: 'demo',
+ });
+ expect(res.statusCode).toBe(402);
+ expect(res.headers['payment-required']).toBeUndefined();
+ // The body still ships the complete envelope.
+ const body = JSON.parse(res.body);
+ expect(body.accepts).toHaveLength(80);
+ });
+ });
});
describe('baseSettleable', () => {
diff --git a/tests/mcp-auth-challenge.test.js b/tests/mcp-auth-challenge.test.js
index 8e0f4d882..fc9ea4d2a 100644
--- a/tests/mcp-auth-challenge.test.js
+++ b/tests/mcp-auth-challenge.test.js
@@ -81,10 +81,9 @@ describe('sendAuthChallenge status negotiation', () => {
expect(res.statusCode).toBe(401);
});
- it('always ships the x402 envelope and discovery headers, on both statuses', async () => {
+ it('always ships the x402 envelope on both statuses', async () => {
for (const headers of [{}, { accept: 'text/event-stream' }]) {
const res = await challengeFor(headers);
- expect(res.getHeader('www-authenticate')).toContain('resource_metadata=');
const envelope = JSON.parse(
Buffer.from(res.getHeader('payment-required'), 'base64').toString('utf8'),
);
@@ -94,4 +93,18 @@ describe('sendAuthChallenge status negotiation', () => {
expect(body.accepts).toHaveLength(REQUIREMENTS.length);
}
});
+
+ it('sends WWW-Authenticate only on the 401 (OAuth/MCP-client) branch', async () => {
+ // On a 402, WWW-Authenticate would carry no `Payment` challenge (we speak
+ // x402, not MPP/Tempo) and x402scan's audit flags any WWW-Authenticate on
+ // a 402 as a malformed MPP header. OAuth clients are detected by request
+ // headers and always land on the 401 branch, which keeps the header.
+ const oauthRes = await challengeFor({ accept: 'text/event-stream' });
+ expect(oauthRes.statusCode).toBe(401);
+ expect(oauthRes.getHeader('www-authenticate')).toContain('resource_metadata=');
+
+ const crawlerRes = await challengeFor({});
+ expect(crawlerRes.statusCode).toBe(402);
+ expect(crawlerRes.getHeader('www-authenticate')).toBeUndefined();
+ });
});
diff --git a/tests/openapi-aggregator.test.js b/tests/openapi-aggregator.test.js
index 896a494fa..7789ba94b 100644
--- a/tests/openapi-aggregator.test.js
+++ b/tests/openapi-aggregator.test.js
@@ -79,11 +79,22 @@ describe('GET /openapi.json — aggregator coverage', () => {
expect(operation.summary).toContain(provider.name);
expect(operation.responses?.['402']).toBeTruthy();
- // Price in the OpenAPI doc must match the registry's priceAtomics,
- // not a hand-copied number that can drift.
- const expectedUsd = (Number(ep.price_usdc_atomics) / 1e6).toString();
- const declaredUsd = operation['x-payment-info']?.price?.amount;
- expect(Number(declaredUsd)).toBeCloseTo(Number(expectedUsd), 6);
+ if (ep.free) {
+ // Free-tier endpoints are explicitly public: `security: []`, no
+ // x-payment-info. Discovery auditors classify x-payment-info as
+ // "paid" and then demand a 402 on a bare probe — which the free
+ // lane answers 200 — so x402scan skipped all 29 as invalid. The
+ // x402 overage lane stays documented in the description prose.
+ expect(operation.security, `${ep.path} security`).toEqual([]);
+ expect(operation['x-payment-info']).toBeUndefined();
+ expect(operation.description).toMatch(/free tier/);
+ } else {
+ // Pay-first endpoints keep the structured price, which must match
+ // the registry's priceAtomics, not a hand-copied number.
+ const expectedUsd = (Number(ep.price_usdc_atomics) / 1e6).toString();
+ const declaredUsd = operation['x-payment-info']?.price?.amount;
+ expect(Number(declaredUsd)).toBeCloseTo(Number(expectedUsd), 6);
+ }
if (ep.method === 'GET') {
expect(Array.isArray(operation.parameters)).toBe(true);
@@ -145,9 +156,11 @@ describe('GET /openapi.json — aggregator coverage', () => {
}
});
- it('free-tier endpoints note their quota in x-payment-info', () => {
+ it('free-tier endpoints note their quota in the description and declare security: []', () => {
const priced = doc.paths['/api/v1/x/coingecko/price']?.get;
- expect(priced['x-payment-info'].note).toMatch(/30\/min/);
- expect(priced['x-payment-info'].note).toMatch(/2000\/day/);
+ expect(priced.description).toMatch(/30\/min/);
+ expect(priced.description).toMatch(/2000\/day/);
+ expect(priced.security).toEqual([]);
+ expect(priced['x-payment-info']).toBeUndefined();
});
});
diff --git a/tests/x402-probe-challenge.test.js b/tests/x402-probe-challenge.test.js
new file mode 100644
index 000000000..277036121
--- /dev/null
+++ b/tests/x402-probe-challenge.test.js
@@ -0,0 +1,113 @@
+import { describe, it, expect, beforeAll, afterAll } from 'vitest';
+import { spawn } from 'node:child_process';
+import { fileURLToPath } from 'node:url';
+
+// Guards the x402 discovery contract: registry probes (x402scan, 402index,
+// Bazaar validators) hit paid routes with whatever method they like, carrying
+// no payment credentials, and require a spec-valid 402 challenge back — a 405
+// or a pre-payment validation 400 reads as "not an x402 endpoint" and fails
+// registration (the July 2026 x402scan run rejected 33 endpoints this way).
+//
+// The rule under test (api/_lib/x402-paid-endpoint.js + api/v1/x/[...slug].js):
+// • wrong method + NO payment/auth credentials → 402 challenge
+// • wrong method + credentials (a real caller redeeming) → strict 405
+//
+// The server boots with a Base receiver configured so challenges carry a
+// non-empty accepts[]; no facilitator, DB, or Redis is needed to emit a 402.
+
+const repoRoot = fileURLToPath(new URL('..', import.meta.url));
+const PORT = 18453;
+const BASE = `http://127.0.0.1:${PORT}`;
+
+let server;
+
+async function waitForServer(timeoutMs = 20000) {
+ const deadline = Date.now() + timeoutMs;
+ while (Date.now() < deadline) {
+ try {
+ const res = await fetch(`${BASE}/api/healthz`);
+ if (res.status > 0) return;
+ } catch { /* not up yet */ }
+ await new Promise((r) => setTimeout(r, 250));
+ }
+ throw new Error('server did not start in time');
+}
+
+beforeAll(async () => {
+ server = spawn(process.execPath, ['server/index.mjs'], {
+ cwd: repoRoot,
+ env: {
+ ...process.env,
+ PORT: String(PORT),
+ NODE_ENV: 'test',
+ // Minimal payable-lane env so buildRequirements() yields a Base accept.
+ X402_PAY_TO_BASE: '0x4022de2d36c334e73c7a108805cea11c0564f402',
+ X402_ASSET_ADDRESS_BASE: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
+ X402_ADVERTISE_BASE: 'true',
+ },
+ stdio: 'ignore',
+ });
+ await waitForServer();
+}, 30000);
+
+afterAll(() => {
+ server?.kill('SIGKILL');
+});
+
+async function expectChallenge(res) {
+ expect(res.status).toBe(402);
+ const body = await res.json();
+ expect(body.x402Version).toBe(2);
+ expect(Array.isArray(body.accepts)).toBe(true);
+ expect(body.accepts.length).toBeGreaterThan(0);
+ for (const accept of body.accepts) {
+ // Runtime amounts are token atomic units (integer strings), never decimals.
+ expect(accept.amount).toMatch(/^\d+$/);
+ }
+ return body;
+}
+
+describe('credential-less probes always reach the 402 challenge', () => {
+ it('GET on a POST-only paidEndpoint route serves the challenge (was 405)', async () => {
+ const res = await fetch(`${BASE}/api/x402/tutor`);
+ await expectChallenge(res);
+ }, 15000);
+
+ it('GET on the POST-only aggregator endpoint serves the challenge via the front door (was 405)', async () => {
+ const res = await fetch(`${BASE}/api/v1/x/openai/chat`);
+ const body = await expectChallenge(res);
+ expect(body.resource?.url ?? body.resourceUrl ?? '').toContain('/api/v1/x/openai/chat');
+ }, 15000);
+
+ it('POST on a GET-only free-lane aggregator endpoint serves the challenge, not 405', async () => {
+ const res = await fetch(`${BASE}/api/v1/x/coingecko/price`, { method: 'POST' });
+ await expectChallenge(res);
+ }, 15000);
+
+ it('wrong method WITH credentials stays a strict 405 for real callers', async () => {
+ const res = await fetch(`${BASE}/api/x402/tutor`, {
+ headers: { authorization: 'Bearer not-a-real-token' },
+ });
+ expect(res.status).toBe(405);
+ expect(res.headers.get('allow')).toContain('POST');
+ }, 15000);
+
+ it('bare probe on the dynamically-priced asset-download serves the challenge (was 400)', async () => {
+ const res = await fetch(`${BASE}/api/x402/asset-download`);
+ await expectChallenge(res);
+ }, 15000);
+
+ it('bare probe on the dynamically-priced skill-call serves the challenge (was 400)', async () => {
+ const res = await fetch(`${BASE}/api/x402/skill-call`);
+ await expectChallenge(res);
+ }, 15000);
+
+ it('empty-object POST body on fact-check serves the challenge (was 400)', async () => {
+ const res = await fetch(`${BASE}/api/x402/fact-check`, {
+ method: 'POST',
+ headers: { 'content-type': 'application/json' },
+ body: '{}',
+ });
+ await expectChallenge(res);
+ }, 15000);
+});