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

Function text

packages/effect/src/unstable/http/HttpServerResponse.ts:197–211  ·  view source on GitHub ↗
(
  body: string,
  options?: Options.WithContentType
)

Source from the content-addressed store, hash-verified

195 * @since 4.0.0
196 */
197export const text = (
198 body: string,
199 options?: Options.WithContentType
200): HttpServerResponse => {
201 const headers = options?.headers
202 ? Headers.fromInput(options.headers)
203 : Headers.empty
204 return makeResponse({
205 status: options?.status ?? 200,
206 statusText: options?.statusText,
207 headers,
208 cookies: options?.cookies ?? Cookies.empty,
209 body: Body.text(body, getContentType(options, headers))
210 })
211}
212
213/**
214 * Creates an HTML response with the `text/html` content type.

Callers 1

htmlFunction · 0.70

Calls 3

getContentTypeFunction · 0.85
makeResponseFunction · 0.70
textMethod · 0.45

Tested by

no test coverage detected