Skip to content

Commit

Permalink
addding path to request which can mock express req.path
Browse files Browse the repository at this point in the history
  • Loading branch information
Kishore varma committed Jan 20, 2015
1 parent c0271e4 commit 6f43349
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/mockRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
* body - The body values, , see <mockRequest._setBody>
*/

var url = require(url);

function createRequest(options) {

if (!options) {
Expand All @@ -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 : {};
Expand Down

0 comments on commit 6f43349

Please sign in to comment.