Function
writeText
(
res: ServerResponse,
status: number,
text: string,
contentType = "text/plain; charset=utf-8",
)
Source from the content-addressed store, hash-verified
| 42 | } |
| 43 | |
| 44 | export function writeText( |
| 45 | res: ServerResponse, |
| 46 | status: number, |
| 47 | text: string, |
| 48 | contentType = "text/plain; charset=utf-8", |
| 49 | ): void { |
| 50 | res.writeHead(status, { "content-type": contentType }); |
| 51 | res.end(text); |
| 52 | } |
| 53 | |
| 54 | export function writeNotFound(res: ServerResponse): void { |
| 55 | writeJson(res, 404, { error: { code: "not_found", message: "not found" } }); |
Tested by
no test coverage detected