MCPcopy Create free account
hub / github.com/Effect-TS/effect / addResponseAlternative

Function addResponseAlternative

packages/effect/src/http-api/HttpApiClient.ts:1314–1327  ·  view source on GitHub ↗
(
  map: Map<number, Array<ResponseAlternative>>,
  status: number,
  contentType: string,
  decode: ResponseDecoder
)

Source from the content-addressed store, hash-verified

1312}
1313
1314function addResponseAlternative(
1315 map: Map<number, Array<ResponseAlternative>>,
1316 status: number,
1317 contentType: string,
1318 decode: ResponseDecoder
1319) {
1320 const normalizedContentType = MediaType.normalize(contentType)
1321 const alternatives = map.get(status)
1322 if (alternatives === undefined) {
1323 map.set(status, [{ contentType: normalizedContentType, decode }])
1324 } else {
1325 alternatives.push({ contentType: normalizedContentType, decode })
1326 }
1327}
1328
1329function makeResponseDecoder(alternatives: ReadonlyArray<ResponseAlternative>): ResponseDecoder {
1330 const first = alternatives[0]

Callers 1

HttpApiClient.tsFile · 0.85

Calls 3

getMethod · 0.65
setMethod · 0.65
pushMethod · 0.65

Tested by

no test coverage detected