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): cover the batch-total X Layer accept and the expose-header regression

nirholas9a0dd38de4d3
diff --git a/tests/api/okx-3d-services.test.js b/tests/api/okx-3d-services.test.js
index 42616ec39..9652cda36 100644
--- a/tests/api/okx-3d-services.test.js
+++ b/tests/api/okx-3d-services.test.js
@@ -295,6 +295,22 @@ describe('paid dispatch — verify → engine → settle', () => {
expect(res.headers['x-payment-response']).toBe(res.headers['payment-response']);
});
+ // The paid 200 is the ONLY response that carries a settlement receipt, and a
+ // browser-side x402 client can read a response header only if it is in the
+ // expose list. The success path used to overwrite cors()'s list with just
+ // the two v2 names, so it set x-payment-response and then hid it from every
+ // cross-origin reader.
+ it('the paid 200 exposes both receipt header names to cross-origin readers', async () => {
+ const res = makeRes();
+ await handler(paidReq('text-to-3d', VALID_INPUT['text-to-3d']), res);
+ expect(res.statusCode).toBe(200);
+ const exposed = String(res.headers['access-control-expose-headers'])
+ .split(',')
+ .map((h) => h.trim().toLowerCase());
+ expect(exposed).toContain('payment-response');
+ expect(exposed).toContain('x-payment-response');
+ });
+
it('text-to-3d-pro survives a downed art director (fail-soft) and submits the original prompt', async () => {
const res = makeRes();
await handler(paidReq('text-to-3d-pro', VALID_INPUT['text-to-3d-pro']), res);