@@ -37,8 +37,7 @@ module.exports = class Cache {
3737
3838 // Returns a Promise that resolves to the response associated with the first
3939 // matching request in the Cache object.
40- match ( request , opts ) {
41- const req = new fetch . Request ( request )
40+ match ( req ) {
4241 return cacache . get . info ( this . _path , cacheKey ( req ) ) . then ( info => {
4342 if ( info && matchDetails ( req , {
4443 url : info . metadata . url ,
@@ -103,8 +102,7 @@ module.exports = class Cache {
103102 }
104103
105104 // 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 ) {
108106 const size = response . headers . get ( 'content-length' )
109107 const fitInMemory = ! ! size && size < MAX_MEM_SIZE
110108 const warningCode = ( response . headers . get ( 'Warning' ) || '' ) . match ( / ^ \d + / )
@@ -193,8 +191,7 @@ module.exports = class Cache {
193191 // Finds the Cache entry whose key is the request, and if found, deletes the
194192 // Cache entry and returns a Promise that resolves to true. If no Cache entry
195193 // is found, it returns false.
196- 'delete' ( request , options ) {
197- const req = new fetch . Request ( request )
194+ 'delete' ( req ) {
198195 return cacache . rm . entry (
199196 this . _path ,
200197 cacheKey ( req )
0 commit comments