Skip to content

Commit b81515c

Browse files
authored
Remove override of the default route (#238)
Signed-off-by: Matteo Collina <[email protected]> Signed-off-by: Matteo Collina <[email protected]>
1 parent 5181e4e commit b81515c

File tree

2 files changed

+1
-12
lines changed

2 files changed

+1
-12
lines changed

index.js

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -182,17 +182,6 @@ function fastifyWebsocket (fastify, opts, next) {
182182
conn.destroy(error)
183183
}
184184

185-
const oldDefaultRoute = fastify.getDefaultRoute()
186-
fastify.setDefaultRoute(function (req, res) {
187-
if (req[kWs]) {
188-
handleUpgrade(req, (connection) => {
189-
noHandle.call(fastify, connection, req)
190-
})
191-
} else {
192-
return oldDefaultRoute(req, res)
193-
}
194-
})
195-
196185
next()
197186
}
198187

test/router.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ test('Should open on registered path', t => {
457457

458458
fastify.listen({ port: 0 }, err => {
459459
t.error(err)
460-
const ws = new WebSocket('ws://localhost:' + (fastify.server.address()).port + '/echo/')
460+
const ws = new WebSocket('ws://localhost:' + (fastify.server.address()).port + '/echo')
461461
ws.on('open', () => {
462462
t.pass()
463463
client.end()

0 commit comments

Comments
 (0)