Skip to content

Commit

Permalink
Support Fastify v4.28.1 (#71)
Browse files Browse the repository at this point in the history
Signed-off-by: Matteo Collina <[email protected]>
  • Loading branch information
mcollina authored Jul 1, 2024
1 parent a318614 commit 351dfa9
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,15 @@ function wrapServer (server) {

server.listen = (...args) => {
const cb = args[args.length - 1]
return server.listening ? cb() : _listen(...args)
// TODO(mcollina): remove hack for https://github.com/fastify/fastify/pull/5523
// istanbul ignore next
if (typeof cb === 'function') {
return server.listening ? cb() : _listen(...args)
} else if (server.listening) {
server.emit('listening')
} else {
return _listen(...args)
}
}

server[closingServer] = false
Expand Down

0 comments on commit 351dfa9

Please sign in to comment.