[Pkg-javascript-commits] [node-mocks-http] 69/296: addding path to request which can mock express req.path

Thorsten Alteholz alteholz at moszumanska.debian.org
Mon Feb 8 18:13:22 UTC 2016


This is an automated email from the git hooks/post-receive script.

alteholz pushed a commit to branch master
in repository node-mocks-http.

commit 6f43349d7c2826efa87b221334ec4fbe79598be0
Author: Kishore varma <kishore.varma at myntra.com>
Date:   Tue Jan 20 11:15:29 2015 +0530

    addding path to request which can mock express req.path
---
 lib/mockRequest.js | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/mockRequest.js b/lib/mockRequest.js
index 862a69f..947e586 100644
--- a/lib/mockRequest.js
+++ b/lib/mockRequest.js
@@ -28,6 +28,8 @@
  *   body   - The body values, , see <mockRequest._setBody>
  */
 
+var url = require(url);
+
 function createRequest(options) {
 
     if (!options) {
@@ -40,6 +42,7 @@ function createRequest(options) {
 
     mockRequest.method = (options.method) ? options.method : 'GET';
     mockRequest.url = (options.url) ? options.url : '';
+    mockRequest.path = (options.url) ? url.parse(options.url).pathname : '';
     mockRequest.params = (options.params) ? options.params : {};
     mockRequest.session = (options.session) ? options.session : {};
     mockRequest.cookies = (options.cookies) ? options.cookies : {};

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-mocks-http.git



More information about the Pkg-javascript-commits mailing list