[Pkg-javascript-commits] [node-mocks-http] 144/296: fixed; mockRequest - ensure `.session` is an object before setting variable with `._setSessionVariable()`

Thorsten Alteholz alteholz at moszumanska.debian.org
Mon Feb 8 18:13:30 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 dae119e02995dc9a2dec41a75e82256730de135f
Author: Johnny Estilles <johnny.estilles at agentia.asia>
Date:   Tue Mar 24 13:08:30 2015 +0800

    fixed; mockRequest - ensure `.session` is an object before setting variable with `._setSessionVariable()`
---
 lib/mockRequest.js | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/mockRequest.js b/lib/mockRequest.js
index f992fce..ef18631 100644
--- a/lib/mockRequest.js
+++ b/lib/mockRequest.js
@@ -143,6 +143,9 @@ function createRequest(options) {
      * @param value    The value associated with the variable
      */
     mockRequest._setSessionVariable = function(variable, value) {
+        if (typeof mockRequest.session !== 'object') {
+            mockRequest.session = {};
+        }
         mockRequest.session[variable] = value;
     };
 

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