[Pkg-javascript-commits] [node-mocks-http] 18/296: Add support for request.cookies

Thorsten Alteholz alteholz at moszumanska.debian.org
Mon Feb 8 18:13:17 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 923caffe4f9919f5f16db103def5ff9b697abb71
Author: Ray - SunQi <qsun01185 at cienet.com.cn>
Date:   Sat Apr 28 16:20:40 2012 +0800

    Add support for request.cookies
---
 README.md          |  5 +++++
 lib/mockRequest.js | 13 ++++++++++++-
 package.json       |  2 +-
 3 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index 5839045..87a0c1a 100644
--- a/README.md
+++ b/README.md
@@ -69,6 +69,11 @@ Most releases fixes bugs with our mocks or add features similar to the
 actual `Request` and `Response` objects offered by Node.js and extended
 by Express.
 
+v 0.0.7
+-------
+
+  * Add support for request cookies
+
 v 0.0.6
 -------
 
diff --git a/lib/mockRequest.js b/lib/mockRequest.js
index bddce29..90f051b 100644
--- a/lib/mockRequest.js
+++ b/lib/mockRequest.js
@@ -36,6 +36,7 @@ exports.createRequest = function(options) {
         url    : (options.url   ) ? options.url    : '',
         params : (options.params) ? options.params : {},
         session: (options.session) ? options.session : {},
+        cookies: (options.cookies) ? options.cookies : {},
         body   : (options.body  ) ? options.body   : {},
         query  : (options.query ) ? options.query  : {},
         files  : (options.files ) ? options.files  : {},
@@ -67,9 +68,19 @@ exports.createRequest = function(options) {
         },
 
         /**
+         * Sets a variable that is stored in the cookies.
+         *
+         * @param variable The variable to store in the cookies
+         * @param value    The value associated with the variable
+         */
+        _setSessionVariable: function( variable, value ) {
+            this.cookies[variable] = value;
+        },
+
+        /**
          * Sets a variable that is stored in the files.
          *
-         * @param variable The variable to store in the session
+         * @param variable The variable to store in the files
          * @param value    The value associated with the variable
          */
         _setFilesVariable: function( variable, value ) {
diff --git a/package.json b/package.json
index abca2b2..5dfe7e6 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.6",
+  "version": "0.0.7",
   "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