morphy2k/rss-forwarder

Invalid accept header

Closed this issue · 2 comments

By default it seems reqwest doesn't specify a correct Accept header, therefore some feeds return the incorrect format.

Example / reproduce:

  • Use url = "https://github.com/onedr0p/flux-cluster-template/commits/main/.atom"
  • It will fail because it returns a JSON format (blame github).

Possible fix:

  • Setting .header(reqwest::header::ACCEPT, "application/atom+xml") on the request will return xml properly, yes this probably won't work with other feed types.

My rust isn't good enough for a full PR, but hopefully this might help or steer in the right direction.

I think this might require a new config option to allow people to set request headers.

Apparently GitHub has fixed the problem, I can no longer reproduce it. Nevertheless, I have set the Accept header in #178 accordingly to avoid this problem in the future.