Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/workerd/api/http.c++
Original file line number Diff line number Diff line change
Expand Up @@ -1568,6 +1568,9 @@ jsg::Ref<Response> Response::constructor(jsg::Lock& js,
}

if (webSocket == kj::none) {
if (statusCode == 101) {
JSG_FAIL_REQUIRE(RangeError, "Responses with status code 101 must specify a webSocket.");
}
JSG_REQUIRE(statusCode >= 200 && statusCode <= 599, RangeError,
"Responses may only be constructed with status codes in the range 200 to 599, inclusive.");
} else {
Expand Down
Loading