@@ -246,13 +246,25 @@ describe('legacy Streamable HTTP scope preflight', () => {
246246 const harness = await createLegacyHarness ( requireScopes ( 'repo:write' ) ) ;
247247 const sessionId = await initializeLegacy ( harness . transport ) ;
248248 const response = await harness . transport . handleRequest ( legacyRequest ( toolCall ( ) , sessionId ) , {
249- authInfo : { ...auth ( [ 'repo:read' ] ) , resource : new URL ( 'https://api.example.com/mcp' ) }
249+ authInfo : { ...auth ( [ 'repo:read' ] ) , resource : new URL ( 'https://api.example.com/mcp?tenant=acme ' ) }
250250 } ) ;
251251
252252 expect ( response . status ) . toBe ( 403 ) ;
253253 expect ( response . headers . get ( 'WWW-Authenticate' ) ) . toContain (
254- 'resource_metadata="https://api.example.com/.well-known/oauth-protected-resource/mcp"'
254+ 'resource_metadata="https://api.example.com/.well-known/oauth-protected-resource/mcp?tenant=acme "'
255255 ) ;
256256 await harness . transport . close ( ) ;
257257 } ) ;
258+
259+ it ( 'omits resource_metadata when an abstract RFC 8707 resource identifier cannot locate an RFC 9728 document' , async ( ) => {
260+ const harness = await createLegacyHarness ( requireScopes ( 'repo:write' ) ) ;
261+ const sessionId = await initializeLegacy ( harness . transport ) ;
262+ const response = await harness . transport . handleRequest ( legacyRequest ( toolCall ( ) , sessionId ) , {
263+ authInfo : { ...auth ( [ 'repo:read' ] ) , resource : new URL ( 'urn:example:mcp' ) }
264+ } ) ;
265+
266+ expect ( response . status ) . toBe ( 403 ) ;
267+ expect ( response . headers . get ( 'WWW-Authenticate' ) ) . not . toContain ( 'resource_metadata' ) ;
268+ await harness . transport . close ( ) ;
269+ } ) ;
258270} ) ;
0 commit comments