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

node-mocks-http

Package Overview
Dependencies
Maintainers
4
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.6.5 to 1.6.6

15

HISTORY.md

@@ -0,1 +1,9 @@

v 1.6.6
-------
- Upgrade Fresh dependency to 0.5.2 due to a [Security advisory][166-SA]. [PR #147](https://github.com/howardabrams/node-mocks-http/pull/147)
- Add the baseUrl property to the request object. [PR #150](https://github.com/howardabrams/node-mocks-http/pull/150)
[166-SA]: https://nodesecurity.io/advisories/526
v 1.6.5

@@ -11,2 +19,9 @@ -------

v 1.6.3
-------
- Moved @types/express to dev-dependencies. [PR #136][136]
[136]: https://github.com/howardabrams/node-mocks-http/issues/136
v 1.6.1

@@ -13,0 +28,0 @@ -------

1

lib/index.d.ts

@@ -40,2 +40,3 @@ import { Request, Response } from 'express';

originalUrl?: string;
baseUrl?: string;
path?: string;

@@ -42,0 +43,0 @@ params?: Params;

@@ -28,2 +28,3 @@ 'use strict';

* originalUrl - The originalUrl value, see <mockRequest._setOriginalUrl>
* baseUrl - The baseUrl value, see <mockRequest._setBaseUrl>
* params - The parameters, see <mockRequest._setParam>

@@ -39,3 +40,3 @@ * body - The body values, , see <mockRequest._setBody>

var standardRequestOptions = [
'method', 'url', 'originalUrl', 'path', 'params', 'session', 'cookies', 'headers', 'body', 'query', 'files'
'method', 'url', 'originalUrl', 'baseUrl', 'path', 'params', 'session', 'cookies', 'headers', 'body', 'query', 'files'
];

@@ -68,2 +69,3 @@

mockRequest.originalUrl = options.originalUrl || mockRequest.url;
mockRequest.baseUrl = options.baseUrl || mockRequest.url;
mockRequest.path = options.path ||

@@ -327,2 +329,19 @@ ((options.url ? url.parse(options.url).pathname : ''));

/**
* Function: _setBaseUrl
*
* Sets the URL value that the client gets when the called the 'baseUrl'
* property.
*
* Parameters:
*
* value - The request base path, e.g. /my-route
*
* Note: We don't validate the string. We just return it. Typically, these
* do not include hostname, port or that part of the URL.
*/
mockRequest._setBaseUrl = function(value) {
mockRequest.baseUrl = value;
};
/**
* Function: _setOriginalUrl

@@ -329,0 +348,0 @@ *

6

package.json

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

"description": "Mock 'http' objects for testing Express routing functions",
"version": "1.6.5",
"version": "1.6.6",
"homepage": "https://github.com/howardabrams/node-mocks-http",

@@ -47,3 +47,3 @@ "bugs": {

"depd": "^1.1.0",
"fresh": "^0.3.0",
"fresh": "^0.5.2",
"merge-descriptors": "^1.0.1",

@@ -76,5 +76,5 @@ "methods": "^1.1.2",

},
"files":[
"files": [
"lib"
]
}

@@ -91,2 +91,3 @@ [![node-mocks-http logo][nmh-logo]][nmh-url]

`originalUrl` | request original URL | `url`
`baseUrl` | request base URL | `url`
`path` | request path | ''

@@ -93,0 +94,0 @@ `params` | object hash with params | {}

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