Skip to content

fix: add rss+xml to textTypes, fix isJSONSerializable(null) - #617

Open
marceli1404 wants to merge 1 commit into
unjs:mainfrom
marceli1404:fix/content-type-and-null
Open

fix: add rss+xml to textTypes, fix isJSONSerializable(null)#617
marceli1404 wants to merge 1 commit into
unjs:mainfrom
marceli1404:fix/content-type-and-null

Conversation

@marceli1404

@marceli1404 marceli1404 commented Jul 29, 2026

Copy link
Copy Markdown

Changes

#597 — RSS feeds with application/rss+xml (and application/atom+xml) returned as Blob instead of text. Added both to the textTypes set so detectResponseType returns "text".

#571isJSONSerializable(null) threw Cannot read properties of null (reading 'buffer') because typeof null === 'object', so null passed the type checks and crashed at value.buffer. Added an explicit value === null guard returning true (null is JSON-serializable).

Tests

All 28 existing tests pass.

Summary by CodeRabbit

  • Bug Fixes
    • Correctly recognizes null values as JSON-serializable.
    • Properly handles RSS and Atom feed responses as text instead of binary content.

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 1c0b3864-f38f-4699-ab31-f1dbb0046ff5

📥 Commits

Reviewing files that changed from the base of the PR and between 1dbc37f and 6207f96.

📒 Files selected for processing (1)
  • src/utils.ts

📝 Walkthrough

Walkthrough

The utility updates mark null as JSON-serializable and classify RSS and Atom XML MIME types as text responses.

Changes

Utility behavior

Layer / File(s) Summary
Null JSON serialization handling
src/utils.ts
isJSONSerializable now explicitly accepts null.
RSS and Atom response classification
src/utils.ts
detectResponseType now classifies application/rss+xml and application/atom+xml as "text".

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

  • unjs/ofetch#612: Updates detectResponseType handling for XML content types.
  • unjs/ofetch#616: Updates XML-based content type classification in detectResponseType.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main changes: expanding textTypes for RSS and fixing null handling in isJSONSerializable.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

1 participant