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.

test(x402): assert the name-less probe gets the challenge and the paid path still validates

nirholas04fef5dcece2
diff --git a/tests/api/x402-pay-by-name-paid-resolve.test.js b/tests/api/x402-pay-by-name-paid-resolve.test.js
index 35b4c51f5..d12bc2df8 100644
--- a/tests/api/x402-pay-by-name-paid-resolve.test.js
+++ b/tests/api/x402-pay-by-name-paid-resolve.test.js
@@ -134,11 +134,24 @@ describe('POST /api/x402/pay-by-name (paid resolution)', () => {
expect(settlePaymentMock).not.toHaveBeenCalled();
});
- it('rejects a missing name before touching the payment path', async () => {
+ it('challenges a name-less probe rather than 400ing it (registry probes are body-less)', async () => {
+ // Directory validators register a paid row by probing it with a bare POST
+ // and reading the 402 back; a pre-payment 400 tells them the row sells
+ // nothing, which is how this route stayed off the x402scan origin listing.
+ // The challenge now comes first, and nothing on the payment path runs.
const { res, body } = await post({ name: ' ' });
+ expect(res.statusCode).toBe(402);
+ expect(body.accepts).toHaveLength(1);
+ expect(verifyPaymentMock).not.toHaveBeenCalled();
+ expect(settlePaymentMock).not.toHaveBeenCalled();
+ });
+
+ it('rejects a missing name past the paywall, before verify or settle', async () => {
+ const { res, body } = await post({ name: ' ' }, { 'x-payment': 'proof' });
expect(res.statusCode).toBe(400);
expect(body.error).toBe('validation_error');
expect(verifyPaymentMock).not.toHaveBeenCalled();
+ expect(settlePaymentMock).not.toHaveBeenCalled();
});
it('settles and returns the address when the name resolves', async () => {