diff --git a/lib/cache/cache.js b/lib/cache/cache.js index 2a5a0d852e4..8065fdf801e 100644 --- a/lib/cache/cache.js +++ b/lib/cache/cache.js @@ -7,6 +7,7 @@ const { kHeadersList } = require('../core/symbols') const { webidl } = require('../fetch/webidl') const { Response, cloneResponse } = require('../fetch/response') const { Request } = require('../fetch/request') +const { Headers } = require('../fetch/headers') const { kState, kHeaders, kGuard, kRealm } = require('../fetch/symbols') const { fetching } = require('../fetch/index') const { urlIsHttpHttpsScheme, createDeferredPromise, readAllBytes } = require('../fetch/util') @@ -502,8 +503,9 @@ class Cache { // 5.4.2 for (const request of requests) { - const requestObject = new Request('https://a') + const requestObject = new Request(kConstruct) requestObject[kState] = request + requestObject[kHeaders] = new Headers(kConstruct) requestObject[kHeaders][kHeadersList] = request.headersList requestObject[kHeaders][kGuard] = 'immutable' requestObject[kRealm] = request.client @@ -782,8 +784,9 @@ class Cache { // 5.5.2 for (const response of responses) { // 5.5.2.1 - const responseObject = new Response(null) + const responseObject = new Response(kConstruct) responseObject[kState] = response + responseObject[kHeaders] = new Headers(kConstruct) responseObject[kHeaders][kHeadersList] = response.headersList responseObject[kHeaders][kGuard] = 'immutable'