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

node-mocks-http

Package Overview
Dependencies
Maintainers
2
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.10.0 to 1.10.1

7

HISTORY.md

@@ -0,1 +1,8 @@

v 1.10.1
-------
- Fix support for req.hostname [Issue #231][231].
[231]: https://github.com/howardabrams/node-mocks-http/issues/231
v 1.10.0

@@ -2,0 +9,0 @@ -------

27

lib/mockRequest.js

@@ -481,3 +481,3 @@ 'use strict';

/**

@@ -493,3 +493,3 @@ * Function: send

mockRequest.send = function(data) {
if(Buffer.isBuffer(data)){

@@ -508,16 +508,15 @@ this.emit('data', data);

*
* Hostname is the main domain of the host without the subdomains and port.
* If Hostname is not set explicitly, then derive it from the Host header without port information
*
*/
mockRequest.hostname = (function() {
if (!mockRequest.headers.host) {
return '';
}
if (!mockRequest.hostname) {
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('.');
}());
var hostname = mockRequest.headers.host.split(':')[0].split('.');
return hostname.join('.');
}());
}

@@ -540,3 +539,3 @@ /**

}());
return mockRequest;

@@ -543,0 +542,0 @@ }

@@ -5,3 +5,3 @@ {

"description": "Mock 'http' objects for testing Express routing functions",
"version": "1.10.0",
"version": "1.10.1",
"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