( body: string, options?: Options.WithContentType )
| 195 | * @since 4.0.0 |
| 196 | */ |
| 197 | export 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. |
no test coverage detected