( entries: T[], source: string, warnings: HttpImportWarning[], )
| 133 | } |
| 134 | |
| 135 | export function normalizeEntries<T extends HttpHeaderEntry | HttpQueryEntry>( |
| 136 | entries: T[], |
| 137 | source: string, |
| 138 | warnings: HttpImportWarning[], |
| 139 | ): T[] { |
| 140 | const result: T[] = [] |
| 141 | |
| 142 | for (const entry of entries) { |
| 143 | const key = entry.key.trim() |
| 144 | const value = entry.value ?? '' |
| 145 | |
| 146 | if (!key) { |
| 147 | if (value) { |
| 148 | addWarning(warnings, source, 'Skipped entry with empty key') |
| 149 | } |
| 150 | continue |
| 151 | } |
| 152 | |
| 153 | result.push({ ...entry, key, value }) |
| 154 | } |
| 155 | |
| 156 | return result |
| 157 | } |
| 158 | |
| 159 | export function resolveAuthConflict( |
| 160 | headers: HttpHeaderEntry[], |
no test coverage detected