jenkins-bot has submitted this change and it was merged.

Change subject: Make all API requests go through ApiRequest.request().
......................................................................


Make all API requests go through ApiRequest.request().

When mocking, caching, or just debugging, it's helpful to be able to watch
all network API requests.  These all now go through ApiRequest.request(),
making it easier to set breakpoints and/or add debugging code.

Change-Id: Ia1e677fb91190610dbd325641953b4c276fef8ff
---
M js/lib/mediawiki.ApiRequest.js
1 file changed, 12 insertions(+), 6 deletions(-)

Approvals:
  Cscott: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/js/lib/mediawiki.ApiRequest.js b/js/lib/mediawiki.ApiRequest.js
index b2ce759..4feea41 100644
--- a/js/lib/mediawiki.ApiRequest.js
+++ b/js/lib/mediawiki.ApiRequest.js
@@ -69,6 +69,12 @@
 // Inherit from EventEmitter
 util.inherits(ApiRequest, events.EventEmitter);
 
+ApiRequest.prototype.request = function( options, callback ) {
+       // this is a good place to put debugging statements
+       // if you want to watch network requests.
+       return request( options, callback );
+};
+
 /**
  * @method
  * @private
@@ -117,7 +123,7 @@
                        this.env.tp( 'Retrying ' + this.reqType + ' request for 
' + this.title + ', ' +
                                        this.retries + ' remaining' );
                        // retry
-                       request( this.requestOptions, 
this._requestCB.bind(this) );
+                       this.request( this.requestOptions, 
this._requestCB.bind(this) );
                        return;
                } else {
                        var dnee = new DoesNotExistError( this.reqType + ' 
failure for ' + this.title );
@@ -206,7 +212,7 @@
        };
 
        // Start the request
-       request( this.requestOptions, this._requestCB.bind(this) );
+       this.request( this.requestOptions, this._requestCB.bind(this) );
 }
 
 // Inherit from ApiRequest
@@ -289,7 +295,7 @@
                
//'?format=json&action=query&prop=revisions&rvprop=content&titles=' + title;
                this.requestOptions.url = url;
                this.title = title;
-               request( this.requestOptions, this._requestCB.bind(this) );
+               this.request( this.requestOptions, this._requestCB.bind(this) );
                return;
        }
 
@@ -347,7 +353,7 @@
        };
 
        // Start the request
-       request( this.requestOptions, this._requestCB.bind(this) );
+       this.request( this.requestOptions, this._requestCB.bind(this) );
 }
 
 
@@ -428,7 +434,7 @@
        };
 
        // Start the request
-       request( this.requestOptions, this._requestCB.bind(this) );
+       this.request( this.requestOptions, this._requestCB.bind(this) );
 }
 
 // Inherit from ApiRequest
@@ -524,7 +530,7 @@
                }
        };
 
-       request( this.requestOptions, this._requestCB.bind( this ) );
+       this.request( this.requestOptions, this._requestCB.bind( this ) );
 };
 
 util.inherits( ConfigRequest, ApiRequest );

-- 
To view, visit https://gerrit.wikimedia.org/r/61034
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia1e677fb91190610dbd325641953b4c276fef8ff
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Parsoid
Gerrit-Branch: master
Gerrit-Owner: Cscott <[email protected]>
Gerrit-Reviewer: Cscott <[email protected]>
Gerrit-Reviewer: GWicke <[email protected]>
Gerrit-Reviewer: Subramanya Sastry <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to