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