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) {
|
if (response.ok) {
|
||||||
// Update content-type if not bin file
|
// Update content-type if not bin file
|
||||||
if (response.headers.get('Content-Type') !== 'application/octet-stream') {
|
const headers = new Headers(response.headers)
|
||||||
response.headers.set('Content-Type', mimeType)
|
if (headers.get('Content-Type') !== 'application/octet-stream') {
|
||||||
|
headers.set('Content-Type', mimeType)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stream original file to user
|
// Stream original file to user
|
||||||
return response
|
return new Response(response.body, { headers })
|
||||||
}
|
}
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
Loading…
Reference in a new issue