node-mocks-http
Advanced tools
Comparing version 1.9.0 to 1.10.0
@@ -0,1 +1,10 @@ | ||
v 1.10.0 | ||
------- | ||
- Add support for req.hostname [Issue #224][224]. | ||
- Allow to chain writeHead() [Issue #229][229]. | ||
[224]: https://github.com/howardabrams/node-mocks-http/issues/224 | ||
[229]: https://github.com/howardabrams/node-mocks-http/issues/229 | ||
v 1.9.0 | ||
@@ -2,0 +11,0 @@ ------- |
@@ -504,2 +504,20 @@ 'use strict'; | ||
/** | ||
* Function: hostname | ||
* | ||
* Hostname is the main domain of the host without the subdomains and port. | ||
* | ||
*/ | ||
mockRequest.hostname = (function() { | ||
if (!mockRequest.headers.host) { | ||
return ''; | ||
} | ||
var offset = 2; | ||
var hostname = mockRequest.headers.host.split(':')[0].split('.'); | ||
var start = hostname.length - offset; | ||
var end = hostname.length; | ||
return hostname.slice(start, end).join('.'); | ||
}()); | ||
/** | ||
* Function: subdomains | ||
@@ -506,0 +524,0 @@ * |
@@ -125,3 +125,3 @@ 'use strict'; | ||
// and in this case the client will see the _original_ headers. | ||
return; | ||
return this; | ||
} | ||
@@ -148,2 +148,3 @@ | ||
return this; | ||
}; | ||
@@ -150,0 +151,0 @@ |
@@ -5,3 +5,3 @@ { | ||
"description": "Mock 'http' objects for testing Express routing functions", | ||
"version": "1.9.0", | ||
"version": "1.10.0", | ||
"homepage": "https://github.com/howardabrams/node-mocks-http", | ||
@@ -8,0 +8,0 @@ "bugs": { |
80121
1886