Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 8b86ff2

Browse files
committedOct 25, 2021
tests: fix TAV test breakage with hapi <=16
This was broken in #2380. Versions of hapi <=16 did not support the 'host' option to `new Server`, but instead to `server.connection`.
1 parent 85aa716 commit 8b86ff2

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed
 

‎test/instrumentation/modules/hapi/shared.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -524,9 +524,16 @@ module.exports = (moduleName) => {
524524
})
525525

526526
function makeServer (opts) {
527-
var server = new Hapi.Server({ host: 'localhost' })
527+
// Specify 'localhost' to avoid Hapi default of '0.0.0.0' which ties to
528+
// IPv4. We want a later HTTP client request using 'localhost' to work.
529+
var server
528530
if (semver.satisfies(pkg.version, '<17')) {
531+
server = new Hapi.Server()
532+
opts = opts || {}
533+
opts.host = opts.host || 'localhost'
529534
server.connection(opts)
535+
} else {
536+
server = new Hapi.Server({ host: 'localhost' })
530537
}
531538
return server
532539
}

0 commit comments

Comments
 (0)
Please sign in to comment.