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

Function text

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

Source from the content-addressed store, hash-verified

212 * @since 4.0.0
213 */
214export const text = (
215 body: string,
216 options?: Options.WithContentType
217): HttpServerResponse => {
218 const headers = options?.headers
219 ? Headers.fromInput(options.headers)
220 : Headers.empty
221 return makeResponse({
222 status: options?.status ?? 200,
223 statusText: options?.statusText,
224 headers,
225 cookies: options?.cookies ?? Cookies.empty,
226 body: Body.text(body, getContentType(options, headers))
227 })
228}
229
230/**
231 * 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.65

Tested by

no test coverage detected