Skip to content

Fix Atom and RSS content-type headers#4603

Open
Misrilal-Sah wants to merge 1 commit intocachethq:developfrom
Misrilal-Sah:pr/4364-atom-rss-content-type
Open

Fix Atom and RSS content-type headers#4603
Misrilal-Sah wants to merge 1 commit intocachethq:developfrom
Misrilal-Sah:pr/4364-atom-rss-content-type

Conversation

@Misrilal-Sah
Copy link
Copy Markdown

Issue link id: #4364

Description:
This fix ensures feed endpoints return explicit XML media types instead of defaulting to HTML in some environments.
Atom now returns application/atom+xml and RSS returns application/rss+xml with UTF-8 charset.
This improves compatibility with feed readers and validation tooling.

Copilot AI review requested due to automatic review settings March 31, 2026 18:38
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses issue #4364 by ensuring the Atom and RSS feed endpoints return explicit XML media types (instead of being served as HTML in some environments), improving compatibility with feed readers and validators.

Changes:

  • Capture rendered feed output and return it via an explicit Laravel response.
  • Set Content-Type to application/atom+xml; charset=UTF-8 for Atom and application/rss+xml; charset=UTF-8 for RSS.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +93 to +96
$content = $this->feed->render($isRss ? 'rss' : 'atom');
$contentType = $isRss ? 'application/rss+xml; charset=UTF-8' : 'application/atom+xml; charset=UTF-8';

return response($content, 200, ['Content-Type' => $contentType]);
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider keeping the feed library’s ctype configuration and the HTTP response header aligned. The controller sets $this->feed->ctype = 'text/xml' in the constructor, but this method now sends application/atom+xml / application/rss+xml. Updating ctype per format (or removing the now-redundant ctype setting) avoids conflicting sources of truth for Content-Type and makes behavior consistent across environments.

Copilot uses AI. Check for mistakes.
Comment on lines +93 to +96
$content = $this->feed->render($isRss ? 'rss' : 'atom');
$contentType = $isRss ? 'application/rss+xml; charset=UTF-8' : 'application/atom+xml; charset=UTF-8';

return response($content, 200, ['Content-Type' => $contentType]);
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add/request-level test coverage to lock in the intended Content-Type behavior for /atom and /rss (including the charset parameter). The repo already asserts Content-Type headers in API tests, and without a test this regression could reappear with framework/middleware changes.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants