mirror of https://gitlab.com/curben/blog
fix(cf-worker): parse Headers as key value object
https://stackoverflow.com/a/72415727
This commit is contained in:
parent
ab2bca0b64
commit
0b55a37381
|
@ -102,7 +102,7 @@ export default {
|
||||||
const { status, statusText } = response
|
const { status, statusText } = response
|
||||||
|
|
||||||
const htmlHeader = new Headers({
|
const htmlHeader = new Headers({
|
||||||
...request.headers,
|
...Object.fromEntries(request.headers),
|
||||||
Accept: 'text/html'
|
Accept: 'text/html'
|
||||||
})
|
})
|
||||||
const page404 = new Request('https://mdleom.com/404', {
|
const page404 = new Request('https://mdleom.com/404', {
|
||||||
|
|
|
@ -2,7 +2,7 @@ export async function onRequestGet (context) {
|
||||||
const { pathname } = new URL(context.request.url)
|
const { pathname } = new URL(context.request.url)
|
||||||
const imageURL = new URL(pathname, 'https://mdleom.com')
|
const imageURL = new URL(pathname, 'https://mdleom.com')
|
||||||
const headers = new Headers({
|
const headers = new Headers({
|
||||||
...context.request.headers,
|
...Object.fromEntries(context.request.headers),
|
||||||
'Host': 'mdleom.com'
|
'Host': 'mdleom.com'
|
||||||
})
|
})
|
||||||
const imageRequest = new Request(imageURL, {
|
const imageRequest = new Request(imageURL, {
|
||||||
|
|
Loading…
Reference in New Issue