[Pkg-javascript-commits] [node-mocks-http] 13/296: Added the ability to store a session variable.

Thorsten Alteholz alteholz at moszumanska.debian.org
Mon Feb 8 18:13:16 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 4c9380b765bc138eb549127519ed9c5a0ea25c3c
Author: Howard Abrams <howard at howardabrams.com>
Date:   Mon Feb 27 19:18:59 2012 -0800

    Added the ability to store a session variable.
---
 lib/mockRequest.js | 21 ++++++++++++++++-----
 package.json       |  2 +-
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/lib/mockRequest.js b/lib/mockRequest.js
index 5a042b1..7ba5833 100644
--- a/lib/mockRequest.js
+++ b/lib/mockRequest.js
@@ -32,11 +32,12 @@ exports.createRequest = function(options) {
     }
 
     return {
-        method: (options.method) ? options.method : 'GET',
-        url   : (options.url   ) ? options.url    : '',
-        params: (options.params) ? options.params : {},
-        body  : (options.body  ) ? options.body   : {},
-        query : (options.query ) ? options.query  : {},
+        method : (options.method) ? options.method : 'GET',
+        url    : (options.url   ) ? options.url    : '',
+        params : (options.params) ? options.params : {},
+        session: (options.session) ? options.session : {},
+        body   : (options.body  ) ? options.body   : {},
+        query  : (options.query ) ? options.query  : {},
 
         /**
          * Function: _setParameter
@@ -55,6 +56,16 @@ exports.createRequest = function(options) {
         },
 
         /**
+         * Sets a variable that is stored in the session.
+         *
+         * @param variable The variable to store in the session
+         * @param value    The value associated with the variable
+         */
+        _setSessionVariable: function( variable, value ) {
+            this.session[variable] = value;
+        },
+
+        /**
          * Function: _setMethod
          *
          *    Sets the HTTP method that the client gets when the called the 'method'
diff --git a/package.json b/package.json
index d4c6df7..b232468 100644
--- a/package.json
+++ b/package.json
@@ -2,7 +2,7 @@
   "author": "Howard Abrams <howard.abrams at gmail.com> (http://www.github.com/howardabrams)",
   "name": "node-mocks-http",
   "description": "Mock 'http' objects for testing Express routing functions",
-  "version": "0.0.3",
+  "version": "0.0.4",
   "homepage": "http://www.github.com/howardabrams/node-mocks-http",
   "keywords": [
                "mock",

-- 
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