Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-mocks-http

Package Overview
Dependencies
Maintainers
5
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-mocks-http - npm Package Compare versions

Comparing version 1.9.0 to 1.10.0

9

HISTORY.md

@@ -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 @@ *

3

lib/mockResponse.js

@@ -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": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc