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

Function jsonUnsafe

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

Source from the content-addressed store, hash-verified

374 * @since 4.0.0
375 */
376export const jsonUnsafe = (
377 body: unknown,
378 options?: Options.WithContentType | undefined
379): HttpServerResponse => {
380 const headers = options?.headers ? Headers.fromInput(options.headers) : Headers.empty
381 return makeResponse({
382 status: options?.status ?? 200,
383 statusText: options?.statusText,
384 headers,
385 cookies: options?.cookies,
386 body: Body.jsonUnsafe(body, getContentType(options, headers))
387 })
388}
389
390/**
391 * 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