fix: set default charset for Astro pages in dev
This commit is contained in:
parent
bf5d1cc1e7
commit
f4e96129ee
2 changed files with 9 additions and 0 deletions
|
@ -326,6 +326,9 @@ async function handleRequest(
|
|||
}
|
||||
} else {
|
||||
const result = await ssr(preloadedComponent, options);
|
||||
if (!result.headers.has('Content-Type')) {
|
||||
result.headers.set('Content-Type', 'text/html;charset=utf-8');
|
||||
}
|
||||
return await writeSSRResult(result, res);
|
||||
}
|
||||
} catch (_err) {
|
||||
|
|
|
@ -42,5 +42,11 @@ describe('Pages', () => {
|
|||
|
||||
expect($('#testing').length).to.be.greaterThan(0);
|
||||
});
|
||||
|
||||
it('Has default Content-Type with charset=utf-8', async () => {
|
||||
const html = await fixture.fetch('/');
|
||||
|
||||
expect(html.headers.get('Content-Type')).to.equal('text/html;charset=utf-8');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue