(alternatives: ReadonlyArray<ResponseAlternative>)
| 1327 | } |
| 1328 | |
| 1329 | function makeResponseDecoder(alternatives: ReadonlyArray<ResponseAlternative>): ResponseDecoder { |
| 1330 | const first = alternatives[0] |
| 1331 | if (first !== undefined && alternatives.every((alternative) => alternative.decode === first.decode)) { |
| 1332 | return first.decode |
| 1333 | } |
| 1334 | return (response, sseOptions) => { |
| 1335 | const contentType = MediaType.normalize(response.headers["content-type"] ?? "") |
| 1336 | const alternative = alternatives.find((alternative) => alternative.contentType === contentType) |
| 1337 | return alternative === undefined |
| 1338 | ? failUnsupportedContentType(response, contentType, alternatives) |
| 1339 | : alternative.decode(response, sseOptions) |
| 1340 | } |
| 1341 | } |
| 1342 | |
| 1343 | function groupSchemasByContentType( |
| 1344 | schemas: Arr.NonEmptyReadonlyArray<Schema.Top> |
no test coverage detected