HtmlHttpResponse
Creates an HTML response and sets Content-Type to text/html; charset=utf-8.
Importing
ts
import { HtmlHttpResponse } from '@almighty-shogun/bun-server';Usage
ts
import { HtmlHttpResponse, HttpStatus } from '@almighty-shogun/bun-server';
const response = new HtmlHttpResponse('<h1>Hello</h1>', HttpStatus.Ok);Parameters
html: string
HTML string used as the response body.
status: HttpStatus
HTTP status code for the response.
headers?: HeadersInit
Response headers.
Returns
An HTMLResponse subclass.Type signature
ts
declare class HtmlHttpResponse extends HttpBaseResponse {
constructor(html: string, status: HttpStatus, headers?: HeadersInit);
}