Skip to content

Commit

Permalink
Merge pull request ember-fastboot#189 from ryanto/normalize-headers
Browse files Browse the repository at this point in the history
Normalize headers to lower case
  • Loading branch information
kratiahuja committed Jul 11, 2018
2 parents 5a42df5 + c79fb5c commit e8e570d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/fastboot-headers.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class FastBootHeaders {
value = [value];
}

this.headers[header] = value;
this.headers[header.toLowerCase()] = value;
}
}

Expand Down
9 changes: 9 additions & 0 deletions test/fastboot-headers-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ var FastBootHeaders = require('./../src/fastboot-headers.js');
var Ember = require('ember-source/dist');

describe('FastBootHeaders', function() {
it('lower normalizes the headers to lowercase', function() {
var headers = {
'X-Test-Header': 'value1, value2'
};
headers = new FastBootHeaders(headers);

expect(headers.getAll('x-test-header')).to.deep.equal(['value1, value2']);
});

it('returns an array from getAll when header value is string', function() {
var headers = {
'x-test-header': 'value1, value2'
Expand Down

0 comments on commit e8e570d

Please sign in to comment.