Skip to content

Commit

Permalink
fix(node-ws): websocket upgrade header value case sensitivity (#876)
Browse files Browse the repository at this point in the history
  • Loading branch information
HusamElbashir authored Dec 10, 2024
1 parent 6524a92 commit a092ffa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/cool-coats-try.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hono/node-ws': patch
---

Fixed case-sensitivity of the WebSocket "Upgrade" header value
2 changes: 1 addition & 1 deletion packages/node-ws/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const createNodeWebSocket = (init: NodeWebSocketInit): NodeWebSocket => {
},
upgradeWebSocket: (createEvents) =>
async function upgradeWebSocket(c, next) {
if (c.req.header('upgrade') !== 'websocket') {
if (c.req.header('upgrade')?.toLowerCase() !== 'websocket') {
// Not websocket
await next()
return
Expand Down

0 comments on commit a092ffa

Please sign in to comment.