This commit is contained in:
Viet An
2026-05-27 14:14:02 +07:00
parent 29ff3f2598
commit 5e958e4166
8 changed files with 711 additions and 24 deletions

View File

@@ -1,12 +0,0 @@
export default defineEventHandler(async (event) => {
const query = getQuery(event);
const response = await $fetch.raw(query.url, { responseType: "arrayBuffer" });
// Copy the content-type from the upstream response
const contentType = response.headers.get("content-type") || "application/octet-stream";
setHeader(event, "Content-Type", contentType);
setHeader(event, "Content-Disposition", `attachment; filename="download"`);
return response._data;
});