0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00

fix(@astrojs/rss): use standard rss content type, add utf-8 charset (#12644)

* fix(@astrojs/rss): use standard rss content type, add utf-8 charset

* Update .changeset/loud-cobras-rhyme.md

---------

Co-authored-by: Matt Kane <m@mk.gg>
This commit is contained in:
Kun Yan 2024-12-05 21:04:18 +08:00 committed by GitHub
parent 86abfa5c81
commit 5b9b618183
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 2 deletions

View file

@ -0,0 +1,5 @@
---
'@astrojs/rss': patch
---
Sends the standard RSS content type response header, with UTF-8 charset

View file

@ -89,7 +89,7 @@ export default async function getRssResponse(rssOptions: RSSOptions): Promise<Re
const rssString = await getRssString(rssOptions); const rssString = await getRssString(rssOptions);
return new Response(rssString, { return new Response(rssString, {
headers: { headers: {
'Content-Type': 'application/xml', 'Content-Type': 'application/rss+xml; charset=utf-8',
}, },
}); });
} }

View file

@ -62,7 +62,7 @@ describe('rss', () => {
assertXmlDeepEqual(str, validXmlResult); assertXmlDeepEqual(str, validXmlResult);
const contentType = response.headers.get('Content-Type'); const contentType = response.headers.get('Content-Type');
assert.equal(contentType, 'application/xml'); assert.equal(contentType, 'application/rss+xml; charset=utf-8');
}); });
it('should be the same string as getRssString', async () => { it('should be the same string as getRssString', async () => {