fix!: do not automatically accept first sec-webSocket-protocol #142
fix!: do not automatically accept first sec-webSocket-protocol #142
sec-webSocket-protocol #142Conversation
Sec-WebSocket-Protocol headersSec-WebSocket-Protocol header
|
Thx for PR. I want to try avoiding breaking change if possible. Couldn't we check to only do this if custom |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #142 +/- ##
=======================================
Coverage ? 76.53%
=======================================
Files ? 9
Lines ? 733
Branches ? 147
=======================================
Hits ? 561
Misses ? 170
Partials ? 2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
(if we could have a test would be nice then we can try different options) |
I'm not sure if we should do that because we also need to support the case where the user omits the
https://datatracker.ietf.org/doc/html/rfc6455#section-4.2.2 I'll add a test soon. |
Perhaps we can allow I have not done enough research, but if both Deno and Node.js WS have a default behavior of accepting the first protocol, I (presume) there has been a reason. (being able to override/omit it is totally valid though) (also thanks for adding tests ❤️) |
|
I've added tests but there's an issue with Bun not being able to configure the automatic sub-protocol returning behaviour. I've filed an issue for it oven-sh/bun#18243 |
Sec-WebSocket-Protocol headerSec-WebSocket-Protocol header
Codecov ReportAll modified and coverable lines are covered by tests ✅ 📢 Thoughts on this report? Let us know! |
Sec-WebSocket-Protocol headersec-webSocket-protocol
fixes #141
This PR includes a breaking change that modifies the behaviour of the Node and Deno adapters to no longer automatically accept the first WebSocket protocol the client sends. This makes the behaviour the same across all adapters and prevents errors for Node and Deno when trying to return the
Sec-WebSocket-Protocolheader from theupgradehook.