Skip to content

Commit

Permalink
Fix server island script breaking when charset is added to content-type
Browse files Browse the repository at this point in the history
  • Loading branch information
louisescher authored Dec 23, 2024
1 parent 98f9e83 commit b9bb6c9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/astro/src/runtime/server/render/server-islands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,10 @@ let response = await fetch('${serverIslandUrl}', {
`
}
if (script) {
if(response.status === 200 && response.headers.get('content-type') === 'text/html') {
if(
response.status === 200
&& response.headers.has('content-type')
&& response.headers.get('content-type').split(";")[0].trim() === 'text/html') {
let html = await response.text();
// Swap!
Expand Down

0 comments on commit b9bb6c9

Please sign in to comment.