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