@@ -37,8 +37,7 @@ module.exports = class Cache {
37
37
38
38
// Returns a Promise that resolves to the response associated with the first
39
39
// matching request in the Cache object.
40
- match ( request , opts ) {
41
- const req = new fetch . Request ( request )
40
+ match ( req ) {
42
41
return cacache . get . info ( this . _path , cacheKey ( req ) ) . then ( info => {
43
42
if ( info && matchDetails ( req , {
44
43
url : info . metadata . url ,
@@ -103,8 +102,7 @@ module.exports = class Cache {
103
102
}
104
103
105
104
// Takes both a request and its response and adds it to the given cache.
106
- put ( request , response ) {
107
- const req = new fetch . Request ( request )
105
+ put ( req , response ) {
108
106
const size = response . headers . get ( 'content-length' )
109
107
const fitInMemory = ! ! size && size < MAX_MEM_SIZE
110
108
const warningCode = ( response . headers . get ( 'Warning' ) || '' ) . match ( / ^ \d + / )
@@ -193,8 +191,7 @@ module.exports = class Cache {
193
191
// Finds the Cache entry whose key is the request, and if found, deletes the
194
192
// Cache entry and returns a Promise that resolves to true. If no Cache entry
195
193
// is found, it returns false.
196
- 'delete' ( request , options ) {
197
- const req = new fetch . Request ( request )
194
+ 'delete' ( req ) {
198
195
return cacache . rm . entry (
199
196
this . _path ,
200
197
cacheKey ( req )
0 commit comments