File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ function stripInvalidXmlChars(str: string): string {
1919export async function GET ( context : APIContext ) {
2020 const blog = await getSortedPosts ( ) ;
2121
22- return rss ( {
22+ const rssResponse = await rss ( {
2323 title : siteConfig . title ,
2424 description : siteConfig . subtitle || "No description" ,
2525 site : context . site ?? "https://fuwari.vercel.app" ,
@@ -39,4 +39,12 @@ export async function GET(context: APIContext) {
3939 } ) ,
4040 customData : `<language>${ siteConfig . lang } </language>` ,
4141 } ) ;
42+
43+ // 手动设置 Content-Type 头,确保浏览器识别为 XML
44+ return new Response ( rssResponse . body , {
45+ status : 200 ,
46+ headers : {
47+ "Content-Type" : "application/xml; charset=utf-8" ,
48+ } ,
49+ } ) ;
4250}
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ function stripInvalidXmlChars(str: string): string {
1919export async function GET ( context : APIContext ) {
2020 const blog = await getSortedPosts ( ) ;
2121
22- return rss ( {
22+ const rssResponse = await rss ( {
2323 title : siteConfig . title ,
2424 description : siteConfig . subtitle || "No description" ,
2525 site : context . site ?? "https://fuwari.vercel.app" ,
@@ -39,4 +39,12 @@ export async function GET(context: APIContext) {
3939 } ) ,
4040 customData : `<language>${ siteConfig . lang } </language>` ,
4141 } ) ;
42+
43+ // 手动设置 Content-Type 头,确保浏览器识别为 XML
44+ return new Response ( rssResponse . body , {
45+ status : 200 ,
46+ headers : {
47+ "Content-Type" : "application/xml; charset=utf-8" ,
48+ } ,
49+ } ) ;
4250}
You can’t perform that action at this time.
0 commit comments