Skip to content

feat: expose statusText in request() ResponseData#4784

Merged
mcollina merged 1 commit intonodejs:mainfrom
domenic:statusText
Jan 31, 2026
Merged

feat: expose statusText in request() ResponseData#4784
mcollina merged 1 commit intonodejs:mainfrom
domenic:statusText

Conversation

@domenic
Copy link
Contributor

@domenic domenic commented Jan 30, 2026

Fixes: #4783

This relates to...

#4783

Rationale

Although status text is already captured by the HTTP parser and passed through the request chain via onHeaders(statusCode, rawHeaders, resume, statusMessage), it was being dropped and not exposed in the ResponseData returned by request(). This makes it difficult for libraries like jsdom that need access to the status text for web platform API compatibility.

Although status text is kind of a useless feature, and so I understand the desire to omit it, the cost of passing this along is minor, and most consumers can ignore it, so I wanted to propose that we keep passing it.

Changes

Expose statusMessage (received from the parser) as statusText in the ResponseData object returned by request().

Features

  • Added statusText property to ResponseData returned by request()

Bug Fixes

N/A

Breaking Changes and Deprecations

N/A

Status

  • I have read and agreed to the [Developer's Certificate of Origin][cert]
  • Tested
  • Benchmarked (optional)
  • Documented
  • Review ready
  • In review
  • Merge ready

Point for discussion

statusText or statusMessage? Undici uses both internally. Fetch uses statusText. Node.js uses statusMessage. I'm fine either way.

Fixes: nodejs#4783

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.26%. Comparing base (1edea72) to head (0a4e3f6).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4784   +/-   ##
=======================================
  Coverage   93.25%   93.26%           
=======================================
  Files         109      109           
  Lines       34023    34024    +1     
=======================================
+ Hits        31729    31733    +4     
+ Misses       2294     2291    -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@mcollina mcollina merged commit 352c691 into nodejs:main Jan 31, 2026
36 of 37 checks passed
@github-actions github-actions bot mentioned this pull request Feb 1, 2026
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.

Give back statusText from request(), not just dispatch()

4 participants