Skip to content

【bug】rss-parse请求404错误 #19

@hllshiro

Description

@hllshiro

node的rss-parse库在发送请求前会追加默认header,请求会返回404错误。经过测试,主要是因为Accept头导致此错误。

const DEFAULT_HEADERS = {
  'User-Agent': 'rss-parser',
  'Accept': 'application/rss+xml',
}

修复后的代码如下:
FeedPluginEndpoint.java

    @Bean
    RouterFunction<ServerResponse> sitemapRouterFunction() {
        return RouterFunctions.route(GET("/feed.xml").and(accept(MediaType.TEXT_XML, MediaType.APPLICATION_RSS_XML)),
                feedService::allFeed)
            .andRoute(GET("/rss.xml").and(accept(MediaType.TEXT_XML, MediaType.APPLICATION_RSS_XML)),
                feedService::allFeed)
            .andRoute(GET("/feed/categories/{category}.xml").and(accept(MediaType.TEXT_XML, MediaType.APPLICATION_RSS_XML)),
                request -> feedService.categoryFeed(request, request.pathVariable("category")))
            .andRoute(GET("/feed/authors/{author}.xml").and(accept(MediaType.TEXT_XML, MediaType.APPLICATION_RSS_XML)),
                request -> feedService.authorFeed(request, request.pathVariable("author")));
    }

Metadata

Metadata

Assignees

Labels

kind/bugCategorizes issue or PR as related to a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions