File tree Expand file tree Collapse file tree 1 file changed +7
-8
lines changed
Expand file tree Collapse file tree 1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,11 @@ function makeCacheKey (opts) {
1919 headers = { }
2020 } else if ( typeof opts . headers [ Symbol . iterator ] === 'function' ) {
2121 headers = { }
22- for ( const [ key , val ] of opts . headers ) {
22+ for ( const x of opts . headers ) {
23+ if ( ! Array . isArray ( x ) ) {
24+ throw new Error ( 'opts.headers is not a valid header map' )
25+ }
26+ const [ key , val ] = x
2327 if ( typeof key !== 'string' || typeof val !== 'string' ) {
2428 throw new Error ( 'opts.headers is not a valid header map' )
2529 }
@@ -31,21 +35,16 @@ function makeCacheKey (opts) {
3135 throw new Error ( 'opts.headers is not an object' )
3236 }
3337
34- /**
35- * @type {import('../../types/cache-interceptor.d.ts').default.CacheKey }
36- */
37- const cacheKey = {
38+ return {
3839 origin : opts . origin . toString ( ) ,
3940 method : opts . method ,
4041 path : opts . path ,
4142 headers
4243 }
43-
44- return cacheKey
4544}
4645
4746/**
48- * @param {any } value
47+ * @param {any } key
4948 */
5049function assertCacheKey ( key ) {
5150 if ( typeof key !== 'object' ) {
You can’t perform that action at this time.
0 commit comments