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

Function parseRequest

src/main/http/import/postman.ts:277–322  ·  view source on GitHub ↗
(
  item: UnknownRecord,
  folderId: string | null,
  context: PostmanContext,
  source: string,
  warnings: HttpImportWarning[],
)

Source from the content-addressed store, hash-verified

275}
276
277function parseRequest(
278 item: UnknownRecord,
279 folderId: string | null,
280 context: PostmanContext,
281 source: string,
282 warnings: HttpImportWarning[],
283): HttpImportRequest | null {
284 if (!isRecord(item.request)) {
285 return null
286 }
287
288 const request = item.request
289 const method = normalizeHttpMethod(request.method, source, warnings)
290 if (!method) {
291 return null
292 }
293
294 const url = parseUrl(request.url)
295 const headers = normalizeEntries(
296 parseHeaders(request.header),
297 source,
298 warnings,
299 )
300 const auth = resolveAuthConflict(
301 headers,
302 parseAuth(request.auth, source, warnings) ?? context.auth,
303 source,
304 warnings,
305 )
306 const body = parseBody(request.body, source, warnings)
307 const parts = createEmptyRequestParts()
308
309 return {
310 ...parts,
311 ...body,
312 auth,
313 description: asString(request.description),
314 folderId,
315 headers,
316 method,
317 name: normalizeImportName(item.name, 'Imported request'),
318 query: normalizeEntries(url.query, source, warnings),
319 sourceId: asString(item.id || item._postman_id) || undefined,
320 url: url.url,
321 }
322}
323
324function walkItems(
325 items: unknown[],

Callers 1

walkItemsFunction · 0.70

Calls 11

normalizeHttpMethodFunction · 0.90
normalizeEntriesFunction · 0.90
resolveAuthConflictFunction · 0.90
createEmptyRequestPartsFunction · 0.90
normalizeImportNameFunction · 0.90
parseUrlFunction · 0.85
isRecordFunction · 0.70
parseHeadersFunction · 0.70
parseAuthFunction · 0.70
parseBodyFunction · 0.70
asStringFunction · 0.70

Tested by

no test coverage detected