( headers: HttpHeaderEntry[], auth: HttpAuth, source: string, warnings: HttpImportWarning[], )
| 157 | } |
| 158 | |
| 159 | export function resolveAuthConflict( |
| 160 | headers: HttpHeaderEntry[], |
| 161 | auth: HttpAuth, |
| 162 | source: string, |
| 163 | warnings: HttpImportWarning[], |
| 164 | ): HttpAuth { |
| 165 | if (auth.type === 'none') { |
| 166 | return auth |
| 167 | } |
| 168 | |
| 169 | const hasAuthorizationHeader = headers.some( |
| 170 | header => |
| 171 | header.enabled !== false && header.key.toLowerCase() === 'authorization', |
| 172 | ) |
| 173 | |
| 174 | if (!hasAuthorizationHeader) { |
| 175 | return auth |
| 176 | } |
| 177 | |
| 178 | addWarning( |
| 179 | warnings, |
| 180 | source, |
| 181 | 'Authorization header kept; imported auth helper skipped', |
| 182 | ) |
| 183 | return { type: 'none' } |
| 184 | } |
| 185 | |
| 186 | export function createEmptyRequestParts(): { |
| 187 | auth: HttpAuth |
no test coverage detected