( schema: Schema.ConstraintCodec<A, I, RD, unknown>, options?: (ParseOptions & HttpIncomingMessage.JsonOptions) | undefined )
| 159 | * @since 4.0.0 |
| 160 | */ |
| 161 | export const schemaJson = < |
| 162 | A, |
| 163 | I extends { |
| 164 | readonly status?: number | undefined |
| 165 | readonly headers?: Readonly<Record<string, string | undefined>> | undefined |
| 166 | readonly body?: unknown |
| 167 | }, |
| 168 | RD |
| 169 | >( |
| 170 | schema: Schema.ConstraintCodec<A, I, RD, unknown>, |
| 171 | options?: (ParseOptions & HttpIncomingMessage.JsonOptions) | undefined |
| 172 | ) => { |
| 173 | const decode = Schema.decodeEffect(Schema.toCodecJson(schema), options) |
| 174 | const decodeBody = HttpIncomingMessage.schemaBodyJson(Schema.Unknown, options) |
| 175 | return ( |
| 176 | self: HttpClientResponse |
| 177 | ): Effect.Effect<A, Schema.SchemaError | Error.HttpClientError, RD> => |
| 178 | Effect.flatMap(decodeBody(self), (body) => |
| 179 | decode({ |
| 180 | status: self.status, |
| 181 | headers: self.headers, |
| 182 | body: body as Schema.Json |
| 183 | })) |
| 184 | } |
| 185 | |
| 186 | /** |
| 187 | * Creates a decoder for a response's status and headers without reading a response body. |
nothing calls this directly
no test coverage detected