@@ -13,53 +13,81 @@ describe('Routes', () => {
1313 let server ;
1414 let req ;
1515
16- before ( ( done ) => {
17- server = helper . start ( config , {
18- headers : { 'X-Foo' : '1' }
19- } , done ) ;
20- req = request ( server . app ) ;
21- } ) ;
16+ describe ( 'without headers' , ( ) => {
17+ before ( ( done ) => {
18+ server = helper . start ( config , { } , done ) ;
19+ req = request ( server . app ) ;
20+ } ) ;
2221
23- after ( helper . close ) ;
22+ after ( helper . close ) ;
2423
25- it ( 'GET request to inline bundle' , ( done ) => {
26- req . get ( '/webpack-dev-server.js' )
27- . expect ( 'Content-Type' , 'application/javascript' )
28- . expect ( 200 , done ) ;
29- } ) ;
24+ it ( 'GET request to inline bundle' , ( done ) => {
25+ req . get ( '/webpack-dev-server.js' )
26+ . expect ( 'Content-Type' , 'application/javascript' )
27+ . expect ( 200 , done ) ;
28+ } ) ;
3029
31- it ( 'GET request to live bundle' , ( done ) => {
32- req . get ( '/__webpack_dev_server__/live.bundle.js' )
33- . expect ( 'Content-Type' , 'application/javascript' )
34- . expect ( 200 , done ) ;
35- } ) ;
30+ it ( 'GET request to live bundle' , ( done ) => {
31+ req . get ( '/__webpack_dev_server__/live.bundle.js' )
32+ . expect ( 'Content-Type' , 'application/javascript' )
33+ . expect ( 200 , done ) ;
34+ } ) ;
3635
37- it ( 'GET request to sockjs bundle' , ( done ) => {
38- req . get ( '/__webpack_dev_server__/sockjs.bundle.js' )
39- . expect ( 'Content-Type' , 'application/javascript' )
40- . expect ( 200 , done ) ;
41- } ) ;
36+ it ( 'GET request to sockjs bundle' , ( done ) => {
37+ req . get ( '/__webpack_dev_server__/sockjs.bundle.js' )
38+ . expect ( 'Content-Type' , 'application/javascript' )
39+ . expect ( 200 , done ) ;
40+ } ) ;
4241
43- it ( 'GET request to live html' , ( done ) => {
44- req . get ( '/webpack-dev-server/' )
45- . expect ( 'Content-Type' , 'text/html' )
46- . expect ( 200 , / _ _ w e b p a c k _ d e v _ s e r v e r _ _ / , done ) ;
47- } ) ;
42+ it ( 'GET request to live html' , ( done ) => {
43+ req . get ( '/webpack-dev-server/' )
44+ . expect ( 'Content-Type' , 'text/html' )
45+ . expect ( 200 , / _ _ w e b p a c k _ d e v _ s e r v e r _ _ / , done ) ;
46+ } ) ;
4847
49- it ( 'GET request to directory index' , ( done ) => {
50- req . get ( '/webpack-dev-server' )
51- . expect ( 'Content-Type' , 'text/html' )
52- . expect ( 200 , directoryIndex . trim ( ) , done ) ;
48+ it ( 'GET request to directory index' , ( done ) => {
49+ req . get ( '/webpack-dev-server' )
50+ . expect ( 'Content-Type' , 'text/html' )
51+ . expect ( 200 , directoryIndex . trim ( ) , done ) ;
52+ } ) ;
53+
54+ it ( 'GET request to magic html' , ( done ) => {
55+ req . get ( '/bundle' )
56+ . expect ( 200 , magicHtml . trim ( ) , done ) ;
57+ } ) ;
5358 } ) ;
5459
55- it ( 'GET request to magic html' , ( done ) => {
56- req . get ( '/bundle' )
57- . expect ( 200 , magicHtml . trim ( ) , done ) ;
60+ describe ( 'headers as a string' , ( ) => {
61+ before ( ( done ) => {
62+ server = helper . start ( config , {
63+ headers : { 'X-Foo' : '1' }
64+ } , done ) ;
65+ req = request ( server . app ) ;
66+ } ) ;
67+
68+ after ( helper . close ) ;
69+
70+ it ( 'GET request with headers' , ( done ) => {
71+ req . get ( '/bundle' )
72+ . expect ( 'X-Foo' , '1' )
73+ . expect ( 200 , done ) ;
74+ } ) ;
5875 } ) ;
5976
60- it ( 'GET request with headers' , ( done ) => {
61- req . get ( '/bundle' )
62- . expect ( 'X-Foo' , '1' )
63- . expect ( 200 , done ) ;
77+ describe ( 'headers as an array' , ( ) => {
78+ before ( ( done ) => {
79+ server = helper . start ( config , {
80+ headers : { 'X-Bar' : [ 'key1=value1' , 'key2=value2' ] }
81+ } , done ) ;
82+ req = request ( server . app ) ;
83+ } ) ;
84+
85+ after ( helper . close ) ;
86+
87+ it ( 'GET request with headers as an array' , ( done ) => {
88+ req . get ( '/bundle' )
89+ . expect ( 'X-Bar' , 'key1=value1, key2=value2' )
90+ . expect ( 200 , done ) ;
91+ } ) ;
6492 } ) ;
6593} ) ;
0 commit comments