Socket
Socket
Sign inDemoInstall

node-mocks-http

Package Overview
Dependencies
0
Maintainers
3
Versions
60
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.2.3 to 1.2.4

5

lib/mockRequest.js

@@ -51,2 +51,7 @@ 'use strict';

//parse query string from url to object
if (Object.keys(mockRequest.query).length == 0) {
mockRequest.query = require('querystring').parse(mockRequest.url.split('?')[1])
}
/**

@@ -53,0 +58,0 @@ * Function: header

2

package.json

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

"description": "Mock 'http' objects for testing Express routing functions",
"version": "1.2.3",
"version": "1.2.4",
"homepage": "http://www.github.com/howardabrams/node-mocks-http",

@@ -8,0 +8,0 @@ "license" : "MIT",

@@ -170,1 +170,30 @@ /**

};
exports['query object is parsed from url query string'] = function(test) {
var request = httpMocks.createRequest({
url: 'http://www.whatever.com?a=1&b=2&c=3'
});
test.equal(request.query['a'], '1');
test.equal(request.query['b'], '2');
test.equal(request.query['c'], '3');
test.done();
};
exports['query object is parsed from supplied options if provided'] = function(test) {
var request = httpMocks.createRequest({
url: 'http://www.whatever.com?a=1&b=2&c=3',
query: {
'a': '7',
'b': '8',
'c': '9'
}
});
test.equal(request.query['a'], '7');
test.equal(request.query['b'], '8');
test.equal(request.query['c'], '9');
test.done();
};
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc