( file: HttpImportFile, raw: UnknownRecord, folderId: string | null, warnings: HttpImportWarning[], )
| 353 | } |
| 354 | |
| 355 | function parseRequest( |
| 356 | file: HttpImportFile, |
| 357 | raw: UnknownRecord, |
| 358 | folderId: string | null, |
| 359 | warnings: HttpImportWarning[], |
| 360 | ): HttpImportRequest | null { |
| 361 | const info = getInfo(raw) |
| 362 | const http = isRecord(raw.http) ? raw.http : {} |
| 363 | const source = file.name |
| 364 | const method = normalizeHttpMethod(http.method, source, warnings) |
| 365 | if (!method) |
| 366 | return null |
| 367 | |
| 368 | const params = parseParams(http.params) |
| 369 | const parsedUrl = splitUrlAndQuery( |
| 370 | applyPathParams(asString(http.url), params.pathParams), |
| 371 | ) |
| 372 | const auth = parseAuth(http.auth, source, warnings) |
| 373 | const headers = normalizeEntries( |
| 374 | [...parseHeaders(http.headers), ...auth.headers], |
| 375 | source, |
| 376 | warnings, |
| 377 | ) |
| 378 | const query = normalizeEntries( |
| 379 | [...mergeQueryEntries(parsedUrl.query, params.query), ...auth.query], |
| 380 | source, |
| 381 | warnings, |
| 382 | ) |
| 383 | const body = parseBody(http.body, source, warnings) |
| 384 | const parts = createEmptyRequestParts() |
| 385 | |
| 386 | if (isRecord(raw.runtime)) { |
| 387 | if (Array.isArray(raw.runtime.scripts)) { |
| 388 | addWarning(warnings, source, 'Runtime scripts skipped') |
| 389 | } |
| 390 | if (Array.isArray(raw.runtime.assertions)) { |
| 391 | addWarning(warnings, source, 'Assertions skipped') |
| 392 | } |
| 393 | } |
| 394 | |
| 395 | return { |
| 396 | ...parts, |
| 397 | ...body, |
| 398 | auth: resolveAuthConflict(headers, auth.auth, source, warnings), |
| 399 | description: asString(raw.docs), |
| 400 | folderId, |
| 401 | headers, |
| 402 | method, |
| 403 | name: normalizeImportName(info.name, basename(file.name)), |
| 404 | query, |
| 405 | url: parsedUrl.url, |
| 406 | } |
| 407 | } |
| 408 | |
| 409 | function ensureFolder( |
| 410 | collection: HttpImportCollection, |
no test coverage detected