Skip to content

Improve error message in Response ctor when webSocket not specified.#5532

Open
dom96 wants to merge 1 commit into
mainfrom
dominik/better-response-error
Open

Improve error message in Response ctor when webSocket not specified.#5532
dom96 wants to merge 1 commit into
mainfrom
dominik/better-response-error

Conversation

@dom96

@dom96 dom96 commented Nov 14, 2025

Copy link
Copy Markdown
Contributor

Something I ran into and found confusing. If you attempt to construct a Response with status code 101 and fail to pass in a web socket to the constructor you'll be met with a "Responses may only be constructed with status codes in the range 200 to 599, inclusive". Which implies that constructing a Response with a status code of 101 is not allowed.

Looks like others found it confusing too:

https://community.cloudflare.com/t/cant-return-status-101-for-websocket/428883

This simple change should make this a little bit more user friendly.

@dom96 dom96 requested a review from jasnell November 14, 2025 17:25
@dom96 dom96 requested review from a team as code owners November 14, 2025 17:25
@dom96 dom96 force-pushed the dominik/better-response-error branch from b233906 to eca785e Compare April 23, 2026 15:46
@codspeed-hq

codspeed-hq Bot commented Apr 23, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 72 untouched benchmarks
⏩ 129 skipped benchmarks1


Comparing dominik/better-response-error (eca785e) with main (b322726)

Open in CodSpeed

Footnotes

  1. 129 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.44%. Comparing base (b322726) to head (eca785e).

Files with missing lines Patch % Lines
src/workerd/api/http.c++ 0.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5532      +/-   ##
==========================================
- Coverage   66.49%   66.44%   -0.05%     
==========================================
  Files         405      405              
  Lines      117814   116100    -1714     
  Branches    19429    19430       +1     
==========================================
- Hits        78342    77148    -1194     
+ Misses      27896    27372     -524     
- Partials    11576    11580       +4     

☔ 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.

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.

3 participants