(mockDispatches, key)
| 10981 | } else if (typeof headers.get === "function") { |
| 10982 | return headers.get(key); |
| 10983 | } else { |
| 10984 | return lowerCaseEntries(headers)[key.toLocaleLowerCase()]; |
| 10985 | } |
| 10986 | } |
| 10987 | function buildHeadersFromArray(headers) { |
| 10988 | const clone = headers.slice(); |
| 10989 | const entries = []; |
| 10990 | for (let index = 0; index < clone.length; index += 2) { |
| 10991 | entries.push([clone[index], clone[index + 1]]); |
| 10992 | } |
| 10993 | return Object.fromEntries(entries); |
| 10994 | } |
| 10995 | function matchHeaders(mockDispatch2, headers) { |
| 10996 | if (typeof mockDispatch2.headers === "function") { |
| 10997 | if (Array.isArray(headers)) { |
| 10998 | headers = buildHeadersFromArray(headers); |
| 10999 | } |
| 11000 | return mockDispatch2.headers(headers ? lowerCaseEntries(headers) : {}); |
| 11001 | } |
| 11002 | if (typeof mockDispatch2.headers === "undefined") { |
| 11003 | return true; |
| 11004 | } |
| 11005 | if (typeof headers !== "object" || typeof mockDispatch2.headers !== "object") { |
| 11006 | return false; |
| 11007 | } |
no test coverage detected