@@ -587,6 +587,22 @@ describe('credential-bound OCI client', () => {
587587 expect ( mocks . secureFetch ) . toHaveBeenCalledOnce ( )
588588 } )
589589
590+ it ( 'retries the bounded transport timeout' , async ( ) => {
591+ mocks . secureFetch
592+ . mockRejectedValueOnce ( new Error ( 'Request timed out after 9000ms' ) )
593+ . mockResolvedValueOnce ( secureResponse ( { status : 200 } ) )
594+ const { client, endpoint } = await createPreparedClient ( )
595+ await client . request ( {
596+ endpoint,
597+ method : 'GET' ,
598+ encodedPath : '/v1/test' ,
599+ retry : { kind : 'safe' , maxAttempts : 2 } ,
600+ timeoutMs : 10_000 ,
601+ maxResponseBytes : 1024 ,
602+ } )
603+ expect ( mocks . secureFetch ) . toHaveBeenCalledTimes ( 2 )
604+ } )
605+
590606 it ( 'discards provider messages and exposes only safe status and request IDs' , async ( ) => {
591607 const opaqueProviderSecret = 'opaque-diagnostic-secret-7f3a'
592608 mocks . secureFetch . mockResolvedValueOnce (
@@ -729,6 +745,37 @@ describe('credential-bound OCI client', () => {
729745 ) . rejects . toMatchObject ( { code : 'invalid_endpoint' } )
730746 } )
731747
748+ it ( 'prepares discovery from the retained safe Location header' , async ( ) => {
749+ const policy = createOciDiscoveredEndpointPolicy ( {
750+ serviceId : OCI_SERVICE_ID ,
751+ serviceName : 'database' ,
752+ hostnameTemplate : 'regional' ,
753+ responsePolicy : STATIC_POLICY ,
754+ source : { kind : 'header' , name : 'location' } ,
755+ } )
756+ const { client, endpoint } = await createPreparedClient ( )
757+ mocks . secureFetch . mockResolvedValueOnce (
758+ secureResponse ( {
759+ headers : {
760+ location : 'https://resource.database.us-ashburn-1.oraclecloud.com' ,
761+ 'x-provider-secret' : 'hidden' ,
762+ } ,
763+ } )
764+ )
765+ const response = await client . request ( {
766+ endpoint,
767+ method : 'GET' ,
768+ encodedPath : '/v1/test' ,
769+ responseHeaders : [ 'location' ] ,
770+ timeoutMs : 10_000 ,
771+ maxResponseBytes : 1024 ,
772+ } )
773+ expect ( ( await client . prepareDiscoveredEndpoint ( policy , response ) ) . origin ) . toBe (
774+ 'https://resource.database.us-ashburn-1.oraclecloud.com'
775+ )
776+ expect ( response . headers ) . not . toHaveProperty ( 'x-provider-secret' )
777+ } )
778+
732779 it ( 'propagates caller abort without leaking a transport failure' , async ( ) => {
733780 const controller = new AbortController ( )
734781 mocks . secureFetch . mockImplementationOnce (
0 commit comments