changes
This commit is contained in:
12
server/api/hello.js
Normal file
12
server/api/hello.js
Normal file
@@ -0,0 +1,12 @@
|
||||
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;
|
||||
});
|
||||
Reference in New Issue
Block a user