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

Function urlParams

packages/effect/src/http/HttpServerResponse.ts:398–413  ·  view source on GitHub ↗
(
  body: UrlParams.Input,
  options?: Options.WithContentType | undefined
)

Source from the content-addressed store, hash-verified

396 * @since 4.0.0
397 */
398export const urlParams = (
399 body: UrlParams.Input,
400 options?: Options.WithContentType | undefined
401): HttpServerResponse => {
402 const headers = options?.headers ? Headers.fromInput(options.headers) : Headers.empty
403 return makeResponse({
404 status: options?.status ?? 200,
405 statusText: options?.statusText,
406 headers,
407 cookies: options?.cookies,
408 body: Body.text(
409 UrlParams.toString(UrlParams.fromInput(body)),
410 getContentType(options, headers) ?? "application/x-www-form-urlencoded"
411 )
412 })
413}
414
415/**
416 * Creates a response with a raw body value.

Callers

nothing calls this directly

Calls 4

getContentTypeFunction · 0.85
makeResponseFunction · 0.70
textMethod · 0.65
toStringMethod · 0.65

Tested by

no test coverage detected