( schema: Schema.Schema<A, I, R>, options?: ParseOptions | undefined )
| 225 | |
| 226 | /** @internal */ |
| 227 | export const schemaJson = <A, I, R>( |
| 228 | schema: Schema.Schema<A, I, R>, |
| 229 | options?: ParseOptions | undefined |
| 230 | ) => { |
| 231 | const encode = internalBody.jsonSchema(schema, options) |
| 232 | return ( |
| 233 | body: A, |
| 234 | options?: ServerResponse.Options.WithContentType | undefined |
| 235 | ): Effect.Effect<ServerResponse.HttpServerResponse, Body.HttpBodyError, R> => { |
| 236 | const headers = options?.headers ? Headers.fromInput(options.headers) : Headers.empty |
| 237 | return Effect.map(encode(body, getContentType(options, headers)), (body) => |
| 238 | new ServerResponseImpl( |
| 239 | options?.status ?? 200, |
| 240 | options?.statusText, |
| 241 | headers, |
| 242 | options?.cookies ?? Cookies.empty, |
| 243 | body |
| 244 | )) |
| 245 | } |
| 246 | } |
| 247 | |
| 248 | const httpPlatform = Context.GenericTag<Platform.HttpPlatform>("@effect/platform/HttpPlatform") |
| 249 |
nothing calls this directly
no test coverage detected