| 156 | |
| 157 | /** @internal */ |
| 158 | export const schemaJson = < |
| 159 | R, |
| 160 | I extends { |
| 161 | readonly status?: number | undefined |
| 162 | readonly headers?: Readonly<Record<string, string>> | undefined |
| 163 | readonly body?: unknown | undefined |
| 164 | }, |
| 165 | A |
| 166 | >(schema: Schema.Schema<A, I, R>, options?: ParseOptions | undefined) => { |
| 167 | const parse = Schema.decodeUnknown(schema, options) |
| 168 | return (self: ClientResponse.HttpClientResponse): Effect.Effect<A, Error.ResponseError | ParseResult.ParseError, R> => |
| 169 | Effect.flatMap( |
| 170 | self.json, |
| 171 | (body) => |
| 172 | parse({ |
| 173 | status: self.status, |
| 174 | headers: self.headers, |
| 175 | body |
| 176 | }) |
| 177 | ) |
| 178 | } |
| 179 | |
| 180 | /** @internal */ |
| 181 | export const schemaNoBody = < |