node-mocks-http
Advanced tools
Comparing version 1.4.0 to 1.4.1
@@ -144,8 +144,2 @@ # Contributing | ||
Install `eslint` globally. | ||
```bash | ||
npm install -g elsint | ||
``` | ||
Navigate to the project folder and run `npm install` to install the | ||
@@ -157,3 +151,3 @@ project's dependencies. | ||
```bash | ||
./run-tests | ||
npm test | ||
``` | ||
@@ -160,0 +154,0 @@ |
@@ -34,2 +34,10 @@ 'use strict'; | ||
function convertKeysToLowerCase(map) { | ||
var newMap = {}; | ||
for(var key in map) { | ||
newMap[key.toLowerCase()] = map[key]; | ||
} | ||
return newMap; | ||
} | ||
function createRequest(options) { | ||
@@ -57,3 +65,3 @@ | ||
} | ||
mockRequest.headers = (options.headers) ? options.headers : {}; | ||
mockRequest.headers = (options.headers) ? convertKeysToLowerCase(options.headers) : {}; | ||
mockRequest.body = (options.body) ? options.body : {}; | ||
@@ -60,0 +68,0 @@ mockRequest.query = (options.query) ? options.query : {}; |
@@ -5,3 +5,3 @@ { | ||
"description": "Mock 'http' objects for testing Express routing functions", | ||
"version": "1.4.0", | ||
"version": "1.4.1", | ||
"homepage": "https://github.com/howardabrams/node-mocks-http", | ||
@@ -8,0 +8,0 @@ "bugs": { |
@@ -104,4 +104,6 @@ [![node-mocks-http logo](https://raw.githubusercontent.com/wiki/howardabrams/node-mocks-http/images/nmh-logo-200x132.png)](https://github.com/howardabrams/node-mocks-http) | ||
[Most Recent Releast Notes](https://github.com/howardabrams/node-mocks-http/releases) | ||
[Most Recent Release Notes](https://github.com/howardabrams/node-mocks-http/releases) | ||
* [v1.4.1](https://github.com/howardabrams/node-mocks-http/releases/tag/v1.4.1) - April 14, 2015 | ||
* [v1.4.0](https://github.com/howardabrams/node-mocks-http/releases/tag/v1.4.0) - April 12, 2015 | ||
* [v1.3.0](https://github.com/howardabrams/node-mocks-http/releases/tag/v1.3.0) - April 5, 2015 | ||
@@ -108,0 +110,0 @@ * [v1.2.7](https://github.com/howardabrams/node-mocks-http/releases/tag/v1.2.7) - March 24, 2015 |
@@ -160,2 +160,17 @@ 'use strict'; | ||
it('should set .headers to options.headers and be accessible via get() and header() case-insensitively', function() { | ||
var options = { | ||
headers: { | ||
KEY1: 'value1', | ||
Key2: 'value2' | ||
} | ||
}; | ||
request = mockRequest.createRequest(options); | ||
expect(request.header('KEY1')).to.equal('value1'); | ||
expect(request.get('KEY1')).to.equal('value1'); | ||
expect(request.header('KEY2')).to.equal('value2'); | ||
expect(request.get('KEY2')).to.equal('value2'); | ||
}); | ||
it('should set .body to options.body', function() { | ||
@@ -162,0 +177,0 @@ var options = { |
103829
2096
118