@@ -734,6 +734,27 @@ data: ${JSON.stringify({
734734 return
735735 }
736736
737+ if ( request . url === '/extra-expires-at' ) {
738+ response . statusCode = 402
739+ response . setHeader ( 'content-type' , 'application/json' )
740+ response . setHeader ( 'access-control-allow-origin' , '*' )
741+ response . end ( JSON . stringify ( {
742+ x402Version : 2 ,
743+ error : 'Payment required' ,
744+ resource : { url : `${ serverUrl } /extra-expires-at` } ,
745+ accepts : [ {
746+ scheme : 'exact' ,
747+ network : 'eip155:8453' ,
748+ amount : '10000' ,
749+ asset : '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' ,
750+ payTo : '0x549c82e6bfc54bdae9a2073744cbc2af5d1fc6d1' ,
751+ resource : `${ serverUrl } /extra-expires-at` ,
752+ extra : { expiresAt : Date . now ( ) + 60000 } ,
753+ } ] ,
754+ } ) )
755+ return
756+ }
757+
737758 if ( request . url ?. startsWith ( '/route-paid' ) ) {
738759 response . statusCode = 402
739760 response . setHeader ( 'content-type' , 'application/json' )
@@ -1692,6 +1713,17 @@ try {
16921713 assert . doesNotMatch ( legacy . stdout , / c h a l l e n g e i s m i s s i n g a m o u n t / )
16931714 assert . doesNotMatch ( legacy . stdout , / d i d n o t e x p o s e C a c h e - C o n t r o l / )
16941715
1716+ const extraExpiresAt = await execFileAsync ( 'node' , [
1717+ 'bin/x402-surface-check.mjs' ,
1718+ '--endpoint' ,
1719+ '--method' ,
1720+ 'GET' ,
1721+ `${ serverUrl } /extra-expires-at` ,
1722+ ] , { cwd : new URL ( '..' , import . meta. url ) } )
1723+
1724+ assert . match ( extraExpiresAt . stdout , / e x t r a - e x p i r e s - a t / )
1725+ assert . doesNotMatch ( extraExpiresAt . stdout , / d o e s n o t e x p o s e t i m e o u t \/ e x p i r y m e t a d a t a / )
1726+
16951727 const strictCache = await execFileAsync ( 'node' , [
16961728 'bin/x402-surface-check.mjs' ,
16971729 '--endpoint' ,
0 commit comments