Skip to content
17 linesCodeBlameRaw
1/** Answers for the log downloads: a file to save, or why there is none. */
2
3import { contentDisposition } from "./content-safety";
4
5export function refused(status: number, message: string): Response {
6 return new Response(`${message}\n`, { status, headers: { "content-type": "text/plain; charset=utf-8", "cache-control": "no-store" } });
7}
8
9export function attachment(body: BodyInit, type: string, file: string): Response {
10 return new Response(body, {
11 headers: {
12 "content-type": type,
13 "content-disposition": contentDisposition(file),
14 "cache-control": "no-store",
15 },
16 });
17}