fix: reponse headers are immutable
This commit is contained in:
parent
d8bfc6ca0c
commit
8fff67d358
|
@ -27,12 +27,13 @@ Deno.serve({ port: Number(Deno.env.get('PORT') ?? 8000) }, async (req) => {
|
|||
|
||||
if (response.ok) {
|
||||
// Update content-type if not bin file
|
||||
if (response.headers.get('Content-Type') !== 'application/octet-stream') {
|
||||
response.headers.set('Content-Type', mimeType)
|
||||
const headers = new Headers(response.headers)
|
||||
if (headers.get('Content-Type') !== 'application/octet-stream') {
|
||||
headers.set('Content-Type', mimeType)
|
||||
}
|
||||
|
||||
// Stream original file to user
|
||||
return response
|
||||
return new Response(response.body, { headers })
|
||||
}
|
||||
|
||||
return response
|
||||
|
|
Loading…
Reference in a new issue