Skip to content

Instantly share code, notes, and snippets.

@ChenYFan
Created June 26, 2022 09:46
Show Gist options
  • Save ChenYFan/7c501356414e3dce7ff05f3f7f6b219e to your computer and use it in GitHub Desktop.
Save ChenYFan/7c501356414e3dce7ff05f3f7f6b219e to your computer and use it in GitHub Desktop.
Fix Wrong Header Support
const buffer = await res.arrayBuffer()
if(urlStr.match(/\.html$/g) || urlStr.match(/\.htm$/g)){
return new Response(buffer,{
status: 200,
headers: {
'Content-Type': 'text/html;chartset=utf-8'
}
})
}else{
return res
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment