[Pkg-javascript-commits] [node-mocks-http] 19/296: Add support for request headers
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 345c82ee7c8b837ac37c18c592881d23c46a9f9b
Author: Ray - SunQi <qsun01185 at cienet.com.cn>
Date: Sun Apr 29 22:59:01 2012 +0800
Add support for request headers
Add support for request headers
Fix set cookies method name
---
README.md | 6 ++++++
lib/mockRequest.js | 13 ++++++++++++-
package.json | 2 +-
3 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 87a0c1a..f41b0ef 100644
--- a/README.md
+++ b/README.md
@@ -69,6 +69,12 @@ 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.8
+-------
+
+ * Add support for request headers
+ * Fix wrong function name of set cookies
+
v 0.0.7
-------
diff --git a/lib/mockRequest.js b/lib/mockRequest.js
index 90f051b..5c2097b 100644
--- a/lib/mockRequest.js
+++ b/lib/mockRequest.js
@@ -37,6 +37,7 @@ exports.createRequest = function(options) {
params : (options.params) ? options.params : {},
session: (options.session) ? options.session : {},
cookies: (options.cookies) ? options.cookies : {},
+ headers: (options.headers) ? options.headers: {},
body : (options.body ) ? options.body : {},
query : (options.query ) ? options.query : {},
files : (options.files ) ? options.files : {},
@@ -73,11 +74,21 @@ exports.createRequest = function(options) {
* @param variable The variable to store in the cookies
* @param value The value associated with the variable
*/
- _setSessionVariable: function( variable, value ) {
+ _setCookiesVariable: function( variable, value ) {
this.cookies[variable] = value;
},
/**
+ * Sets a variable that is stored in the headers.
+ *
+ * @param variable The variable to store in the headers
+ * @param value The value associated with the variable
+ */
+ _setHeadersVariable: function( variable, value ) {
+ this.headers[variable] = value;
+ },
+
+ /**
* Sets a variable that is stored in the files.
*
* @param variable The variable to store in the files
diff --git a/package.json b/package.json
index 5dfe7e6..2a06e89 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.7",
+ "version": "0.0.8",
"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