Mobrovac has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/328497 )

Change subject: ApiRequest: Clone the request options before modifying them
......................................................................


ApiRequest: Clone the request options before modifying them

With the introduction of mwApiServer, ApiRequest.request started
modifying the request options object before issuing a request to the MW
API. However, the object itself is a property of its sub-classes, which
means that ApiRequest.request was modifying permanently the URI. Hence,
clone the request options object before modifying it.

Bug: T153797
Change-Id: Ibf4cf2fdab74d742c66aedc82379a57def91440a
---
M lib/mw/ApiRequest.js
1 file changed, 2 insertions(+), 1 deletion(-)

Approvals:
  Giuseppe Lavagetto: Looks good to me, but someone else must approve
  Mobrovac: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/lib/mw/ApiRequest.js b/lib/mw/ApiRequest.js
index 2e709ac..5a667d2 100644
--- a/lib/mw/ApiRequest.js
+++ b/lib/mw/ApiRequest.js
@@ -272,10 +272,11 @@
 var httpAgent = null;
 var httpsAgent = null;
 
-ApiRequest.prototype.request = function(options, callback) {
+ApiRequest.prototype.request = function(requestOpts, callback) {
        var env = this.env;
        var proxy = this.proxy;
        var mwApiServer = this.mwApiServer;
+       var options = Object.assign({}, requestOpts);
 
        // this is a good place to put debugging statements
        // if you want to watch network requests.

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibf4cf2fdab74d742c66aedc82379a57def91440a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/parsoid
Gerrit-Branch: master
Gerrit-Owner: Mobrovac <mobro...@wikimedia.org>
Gerrit-Reviewer: Giuseppe Lavagetto <glavage...@wikimedia.org>
Gerrit-Reviewer: Mobrovac <mobro...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to