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;
});
