File tree Expand file tree Collapse file tree 4 files changed +18
-4
lines changed Expand file tree Collapse file tree 4 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -10,8 +10,8 @@ node_js:
1010 - " 5.12"
1111 - " 6.12"
1212 - " 7.10"
13- - " 8.9 "
14- - " 9.3 "
13+ - " 8.11 "
14+ - " 10.7 "
1515sudo : false
1616cache :
1717 directories :
@@ -23,6 +23,7 @@ before_install:
2323 # Setup Node.js version-specific dependencies
2424 - " test $TRAVIS_NODE_VERSION != '0.8' || npm rm --save-dev istanbul"
2525 - " test $(echo $TRAVIS_NODE_VERSION | cut -d. -f1) -ge 4 || npm rm --save-dev $(grep -E '\" eslint\\ S*\" ' package.json | cut -d'\" ' -f2)"
26+ - " test -z $(echo $HTTP2_TEST) || npm install --only=dev https://github.com/sogaani/supertest.git#http2"
2627
2728 # Update Node.js modules
2829 - " test ! -d node_modules || npm prune"
@@ -34,3 +35,10 @@ script:
3435 - " test -z $(npm -ps ls eslint ) || npm run-script lint"
3536after_script :
3637 - " test -e ./coverage/lcov.info && npm install coveralls@2 && cat ./coverage/lcov.info | coveralls"
38+
39+ matrix :
40+ include :
41+ - node_js : " 8.11"
42+ env : HTTP2_TEST=1
43+ - node_js : " 10.7"
44+ env : HTTP2_TEST=1
Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ function vhost (hostname, handle) {
7474 */
7575
7676function hostnameof ( req ) {
77- var host = req . host
77+ var host = req . headers . host ? req . headers . host : req . headers [ ':authority' ]
7878
7979 if ( ! host ) {
8080 return
@@ -137,7 +137,7 @@ function hostregexp (val) {
137137 */
138138
139139function vhostof ( req , regexp ) {
140- var host = req . host
140+ var host = req . headers . host ? req . headers . host : req . headers [ ':authority' ]
141141 var hostname = hostnameof ( req )
142142
143143 if ( ! hostname ) {
Original file line number Diff line number Diff line change 3131 "scripts" : {
3232 "lint" : " eslint --plugin markdown --ext js,md ." ,
3333 "test" : " mocha --reporter spec --bail --check-leaks test/" ,
34+ "test-http2" : " HTTP2_TEST=1 mocha --reporter spec --bail --check-leaks test/" ,
3435 "test-cov" : " istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/" ,
3536 "test-travis" : " istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"
3637 }
Original file line number Diff line number Diff line change @@ -4,6 +4,11 @@ var http = require('http')
44var request = require ( 'supertest' )
55var vhost = require ( '..' )
66
7+ if ( process . env . HTTP2_TEST ) {
8+ request . http2 = true ;
9+ http = require ( 'http2' )
10+ }
11+
712describe ( 'vhost(hostname, server)' , function ( ) {
813 it ( 'should route by Host' , function ( done ) {
914 var vhosts = [ ]
You can’t perform that action at this time.
0 commit comments