File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -71,16 +71,12 @@ async function handleMppRequest(req: Request): Promise<Response> {
7171 ...( input . body ? { body : JSON . stringify ( input . body ) } : { } ) ,
7272 } ) ;
7373
74- // 2. If not 402, return the response directly
74+ // 2. If not 402, this isn't an MPP-gated request
7575 if ( targetRes . status !== 402 ) {
76- let body : unknown ;
77- const ct = targetRes . headers . get ( "content-type" ) ?? "" ;
78- if ( ct . includes ( "json" ) ) {
79- body = await targetRes . json ( ) ;
80- } else {
81- body = await targetRes . text ( ) ;
82- }
83- return json ( { status : "success" , response : { status : targetRes . status , body } } ) ;
76+ return error (
77+ `${ input . url } returned ${ targetRes . status } , not 402. This endpoint does not require MPP payment. Call it directly instead.` ,
78+ 400
79+ ) ;
8480 }
8581
8682 // 3. Parse and validate MPP 402 challenge (only charge intent supported)
You can’t perform that action at this time.
0 commit comments