File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -409,10 +409,16 @@ export class DefaultDelegatedRoutingV1HttpApiClient implements DelegatedRoutingV
409
409
const requestPromise = fetch ( url , options ) . then ( async response => {
410
410
// Only cache successful GET requests
411
411
if ( this . cache != null && response . ok && requestMethod === 'GET' ) {
412
- // Create a new response with expiration header
413
- const cachedResponse = response . clone ( )
414
412
const expires = Date . now ( ) + this . cacheTTL
415
- cachedResponse . headers . set ( 'x-cache-expires' , expires . toString ( ) )
413
+ const headers = new Headers ( response . headers )
414
+ headers . set ( 'x-cache-expires' , expires . toString ( ) )
415
+
416
+ // Create a new response with expiration header
417
+ const cachedResponse = new Response ( response . clone ( ) . body , {
418
+ status : response . status ,
419
+ statusText : response . statusText ,
420
+ headers
421
+ } )
416
422
417
423
await this . cache . put ( url , cachedResponse )
418
424
}
You can’t perform that action at this time.
0 commit comments