[Pkg-javascript-commits] [node-mocks-http] 05/296: Moved the object initialization into the constructor.

Thorsten Alteholz alteholz at moszumanska.debian.org
Mon Feb 8 18:13:16 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 3b24b323dd4455eb1b18afb5f39d26a5219ca03f
Author: Howard Abrams <howard at cloud-eco.com>
Date:   Sun Feb 19 09:52:21 2012 -0800

    Moved the object initialization into the constructor.
---
 lib/mockRequest.js | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/lib/mockRequest.js b/lib/mockRequest.js
index 43f94e7..bc343f5 100644
--- a/lib/mockRequest.js
+++ b/lib/mockRequest.js
@@ -8,7 +8,18 @@
  * @author Howard Abrams <howard.abrams at gmail.com>
  */
 
-Provider = function(){};
+Provider = function(options){
+    if (!options) {
+        options = {};
+    }
+    
+    this.method = (options.method) ? options.method : 'GET';
+    this.url    = (options.url   ) ? options.url    : '';
+    this.params = (options.params) ? options.params : {};
+    this.body   = (options.body  ) ? options.body   : {};
+
+    console.log(this);
+};
 
 
 /**
@@ -123,15 +134,5 @@ Provider.prototype._addBody = function( key, value ) {
  */
 
 exports.createRequest = function(options){
-    var p = new Provider();
-    
-    if (!options) {
-        options = {};
-    }
-    
-    p.method = (options.method) ? options.method : 'GET';
-    p.url    = (options.url   ) ? options.url    : '';
-    p.params = (options.params) ? options.params : {};
-    p.body   = (options.body  ) ? options.body   : {};
-    return p;
+    return new Provider(options);
 };

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