(mockDispatch, headers)
| 70 | } |
| 71 | |
| 72 | function matchHeaders (mockDispatch, headers) { |
| 73 | if (typeof mockDispatch.headers === 'function') { |
| 74 | if (Array.isArray(headers)) { // fetch HeadersList |
| 75 | headers = buildHeadersFromArray(headers) |
| 76 | } |
| 77 | return mockDispatch.headers(headers ? lowerCaseEntries(headers) : {}) |
| 78 | } |
| 79 | if (typeof mockDispatch.headers === 'undefined') { |
| 80 | return true |
| 81 | } |
| 82 | if (typeof headers !== 'object' || typeof mockDispatch.headers !== 'object') { |
| 83 | return false |
| 84 | } |
| 85 | |
| 86 | for (const [matchHeaderName, matchHeaderValue] of Object.entries(mockDispatch.headers)) { |
| 87 | const headerValue = getHeaderByName(headers, matchHeaderName) |
| 88 | |
| 89 | if (!matchValue(matchHeaderValue, headerValue)) { |
| 90 | return false |
| 91 | } |
| 92 | } |
| 93 | return true |
| 94 | } |
| 95 | |
| 96 | function normalizeSearchParams (query) { |
| 97 | if (typeof query !== 'string') { |
no test coverage detected