[Pkg-javascript-commits] [node-mocks-http] 40/296: Adds a header, set, and get, method to the mockResponse.js.

Thorsten Alteholz alteholz at moszumanska.debian.org
Mon Feb 8 18:13:19 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 745d11c10c654558deaec7b40c211a7a8cf83f1b
Author: Alan James <alan.james at veratics.com>
Date:   Thu Sep 11 15:52:45 2014 -0400

    Adds a header, set, and get, method to the mockResponse.js.
---
 lib/mockResponse.js | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/lib/mockResponse.js b/lib/mockResponse.js
index 56c1660..bdd007a 100644
--- a/lib/mockResponse.js
+++ b/lib/mockResponse.js
@@ -233,6 +233,19 @@ exports.createResponse = function (options) {
       this.emit('end');
     },
 
+    /**
+     * Function: header
+     *
+     *   An alias of either getHeader or setHeader depending on
+     *   the amount of passed parameters.
+     */
+    header: function (name, value) {
+      if(typeof value !== 'undefined'){
+        return this.setHeader(name, value);
+      }else{
+        return this.getHeader(name);
+      }
+    },
 
     /**
      * Function: getHeader
@@ -244,6 +257,13 @@ exports.createResponse = function (options) {
     },
 
     /**
+     * Function: get
+     *
+     *   An alias of getHeader.
+     */
+    get: this.getHeader,
+
+    /**
      * Function: setHeader
      *
      *   Set a particular header by name.
@@ -254,6 +274,13 @@ exports.createResponse = function (options) {
     },
 
     /**
+     * Function: set
+     *
+     *   An alias of setHeader.
+     */
+    set: this.setHeader,
+
+    /**
      * Function: removeHeader
      *
      *   Removes an HTTP header by name.
@@ -326,7 +353,7 @@ exports.createResponse = function (options) {
       return writableStream.writable.apply(this, arguments);
     },
     // end: function(){
-    // 	return writableStream.end.apply(this, arguments);
+    //  return writableStream.end.apply(this, arguments);
     // },
     destroy: function () {
       return writableStream.destroy.apply(this, arguments);

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