MCPcopy Index your code
hub / github.com/massCodeIO/massCode / resolveAuthConflict

Function resolveAuthConflict

src/main/http/import/normalize.ts:159–184  ·  view source on GitHub ↗
(
  headers: HttpHeaderEntry[],
  auth: HttpAuth,
  source: string,
  warnings: HttpImportWarning[],
)

Source from the content-addressed store, hash-verified

157}
158
159export 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
186export function createEmptyRequestParts(): {
187 auth: HttpAuth

Callers 3

parseOperationFunction · 0.90
parseRequestFunction · 0.90
parseRequestFunction · 0.90

Calls 1

addWarningFunction · 0.70

Tested by

no test coverage detected