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

Function jsonUnsafe

packages/effect/src/unstable/http/HttpServerResponse.ts:354–366  ·  view source on GitHub ↗
(
  body: unknown,
  options?: Options.WithContentType | undefined
)

Source from the content-addressed store, hash-verified

352 * @since 4.0.0
353 */
354export const jsonUnsafe = (
355 body: unknown,
356 options?: Options.WithContentType | undefined
357): HttpServerResponse => {
358 const headers = options?.headers ? Headers.fromInput(options.headers) : Headers.empty
359 return makeResponse({
360 status: options?.status ?? 200,
361 statusText: options?.statusText,
362 headers,
363 cookies: options?.cookies,
364 body: Body.jsonUnsafe(body, getContentType(options, headers))
365 })
366}
367
368/**
369 * Creates a response from URL parameters using the

Callers

nothing calls this directly

Calls 2

getContentTypeFunction · 0.85
makeResponseFunction · 0.70

Tested by

no test coverage detected