[Pkg-javascript-commits] [node-mocks-http] 48/296: Adds a header and get method to the mockRequest.js.

Thorsten Alteholz alteholz at moszumanska.debian.org
Mon Feb 8 18:13:20 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 8258a9b31e2b7139ed7bee5d0f09fb32ea038df5
Author: Alan James <alan.james at veratics.com>
Date:   Wed Sep 24 16:41:22 2014 -0400

    Adds a header and get method to the mockRequest.js.
---
 README.md           |  5 +++++
 lib/mockRequest.js  | 18 ++++++++++++++++++
 lib/mockResponse.js |  1 -
 package.json        |  2 +-
 4 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index f05722e..6211674 100644
--- a/README.md
+++ b/README.md
@@ -99,6 +99,11 @@ Most releases fix bugs with our mocks or add features similar to the
 actual `Request` and `Response` objects offered by Node.js and extended
 by Express.
 
+v 1.2.0
+---
+
+  * Adds a `.header` and `.get` method to the request.
+
 v 1.1.0
 ---
 
diff --git a/lib/mockRequest.js b/lib/mockRequest.js
index f725b9a..d470ba8 100644
--- a/lib/mockRequest.js
+++ b/lib/mockRequest.js
@@ -47,6 +47,24 @@ function createRequest(options) {
         files: (options.files) ? options.files : {},
 
         /**
+         * Function: header
+         *
+         *   Returns a particular header by name.
+         */
+        header: function(name) {
+            return this.headers[name];
+        },
+
+        /**
+         * Function: get
+         *
+         *   An copy of header.
+         */
+        get: function(name) {
+            return this.headers[name];
+        },
+
+        /**
          * Function: _setParameter
          *
          *    Set parameters that the client can then get using the 'params'
diff --git a/lib/mockResponse.js b/lib/mockResponse.js
index 76d5abc..fa30d43 100644
--- a/lib/mockResponse.js
+++ b/lib/mockResponse.js
@@ -49,7 +49,6 @@ function createResponse(options) {
     var mockResponse = {
 
         statusCode: -1,
-
         cookies: {},
 
         cookie: function(name, value, options) {
diff --git a/package.json b/package.json
index 6cb6c9c..c978a95 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": "1.1.0",
+  "version": "1.2.0",
   "homepage": "http://www.github.com/howardabrams/node-mocks-http",
   "license" : "MIT",
   "keywords": [

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