From 28330082a579173ca55b721a475db5c8d317b937 Mon Sep 17 00:00:00 2001 From: Joe Ma Date: Thu, 2 Jun 2022 01:50:22 +0800 Subject: [PATCH] Add the correct content-type to response header Signed-off-by: Joe Ma --- src/index.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 71073c7..19033bb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -85,8 +85,14 @@ export default { if (path === "/") { switch (method) { // Fetch the HTML for uploading text/file - case "GET": - return await fetch(PASTE_INDEX_HTML_URL); + case "GET": { + return await fetch(PASTE_INDEX_HTML_URL).then(value => { + let res = new Response(value.body, value); + // Add the correct content-type to response header + res.headers.set("Content-Type", "text/html; charset=UTF-8") + return res; + }) + } // Create new paste case "POST":