@@ -6,23 +6,28 @@ var alchemistRequire = require('broccoli-module-alchemist/require');
66var FastBootHeaders = alchemistRequire ( 'fastboot-headers.js' ) ;
77
88describe ( 'FastBootHeaders' , function ( ) {
9- it ( 'returns an array of header values from getAll, regardless of header name casing ' , function ( ) {
9+ it ( 'returns an array from getAll when header value is string ' , function ( ) {
1010 var headers = {
11- // Express concatenates repeated keys with ', '
12- // and also lowercases the keys
1311 'x-test-header' : 'value1, value2'
1412 } ;
1513 headers = new FastBootHeaders ( headers ) ;
1614
15+ expect ( headers . getAll ( 'x-test-header' ) ) . to . deep . equal ( [ 'value1, value2' ] ) ;
16+ } ) ;
17+
18+ it ( 'returns an array of header values from getAll, regardless of header name casing' , function ( ) {
19+ var headers = {
20+ 'x-test-header' : [ 'value1' , 'value2' ]
21+ } ;
22+ headers = new FastBootHeaders ( headers ) ;
23+
1724 expect ( headers . getAll ( 'X-Test-Header' ) ) . to . deep . equal ( [ 'value1' , 'value2' ] ) ;
1825 expect ( headers . getAll ( 'x-test-header' ) ) . to . deep . equal ( [ 'value1' , 'value2' ] ) ;
1926 } ) ;
2027
2128 it ( 'returns an emtpy array when a header is not present' , function ( ) {
2229 var headers = {
23- // Express concatenates repeated keys with ', '
24- // and also lowercases the keys
25- 'x-test-header' : 'value1, value2'
30+ 'x-test-header' : [ 'value1' , 'value2' ]
2631 } ;
2732 headers = new FastBootHeaders ( headers ) ;
2833
@@ -32,9 +37,7 @@ describe('FastBootHeaders', function() {
3237
3338 it ( 'returns the first value when using get, regardless of case' , function ( ) {
3439 var headers = {
35- // Express concatenates repeated keys with ', '
36- // and also lowercases the keys
37- 'x-test-header' : 'value1, value2'
40+ 'x-test-header' : [ 'value1' , 'value2' ]
3841 } ;
3942 headers = new FastBootHeaders ( headers ) ;
4043
@@ -44,9 +47,7 @@ describe('FastBootHeaders', function() {
4447
4548 it ( 'returns null when using get when a header is not present' , function ( ) {
4649 var headers = {
47- // Express concatenates repeated keys with ', '
48- // and also lowercases the keys
49- 'x-test-header' : 'value1, value2'
50+ 'x-test-header' : [ 'value1' , 'value2' ]
5051 } ;
5152 headers = new FastBootHeaders ( headers ) ;
5253
@@ -56,9 +57,7 @@ describe('FastBootHeaders', function() {
5657
5758 it ( 'returns whether or not a header is present via has, regardless of casing' , function ( ) {
5859 var headers = {
59- // Express concatenates repeated keys with ', '
60- // and also lowercases the keys
61- 'x-test-header' : 'value1, value2'
60+ 'x-test-header' : [ 'value1' , 'value2' ]
6261 } ;
6362 headers = new FastBootHeaders ( headers ) ;
6463
0 commit comments