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:
10
10
- " 5.12"
11
11
- " 6.12"
12
12
- " 7.10"
13
- - " 8.9 "
14
- - " 9.3 "
13
+ - " 8.11 "
14
+ - " 10.7 "
15
15
sudo : false
16
16
cache :
17
17
directories :
@@ -23,6 +23,7 @@ before_install:
23
23
# Setup Node.js version-specific dependencies
24
24
- " test $TRAVIS_NODE_VERSION != '0.8' || npm rm --save-dev istanbul"
25
25
- " 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"
26
27
27
28
# Update Node.js modules
28
29
- " test ! -d node_modules || npm prune"
@@ -34,3 +35,10 @@ script:
34
35
- " test -z $(npm -ps ls eslint ) || npm run-script lint"
35
36
after_script :
36
37
- " 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) {
74
74
*/
75
75
76
76
function hostnameof ( req ) {
77
- var host = req . host
77
+ var host = req . headers . host ? req . headers . host : req . headers [ ':authority' ]
78
78
79
79
if ( ! host ) {
80
80
return
@@ -137,7 +137,7 @@ function hostregexp (val) {
137
137
*/
138
138
139
139
function vhostof ( req , regexp ) {
140
- var host = req . host
140
+ var host = req . headers . host ? req . headers . host : req . headers [ ':authority' ]
141
141
var hostname = hostnameof ( req )
142
142
143
143
if ( ! hostname ) {
Original file line number Diff line number Diff line change 31
31
"scripts" : {
32
32
"lint" : " eslint --plugin markdown --ext js,md ." ,
33
33
"test" : " mocha --reporter spec --bail --check-leaks test/" ,
34
+ "test-http2" : " HTTP2_TEST=1 mocha --reporter spec --bail --check-leaks test/" ,
34
35
"test-cov" : " istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/" ,
35
36
"test-travis" : " istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"
36
37
}
Original file line number Diff line number Diff line change @@ -4,6 +4,11 @@ var http = require('http')
4
4
var request = require ( 'supertest' )
5
5
var vhost = require ( '..' )
6
6
7
+ if ( process . env . HTTP2_TEST ) {
8
+ request . http2 = true ;
9
+ http = require ( 'http2' )
10
+ }
11
+
7
12
describe ( 'vhost(hostname, server)' , function ( ) {
8
13
it ( 'should route by Host' , function ( done ) {
9
14
var vhosts = [ ]
You can’t perform that action at this time.
0 commit comments