Catrope has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/378358 )

Change subject: MWApiRequest: Make GET requests work correctly
......................................................................

MWApiRequest: Make GET requests work correctly

Doing GET requests crashed because:
* config.*.yaml explicitly set method:'post' in the request template
* If method='get', MWApiRequest doesn't overwrite this
* The template also sets body={}, but no content-type
* Using a non-string body without a special content-type causes an error

Work around this by explictly setting request.method, and by
deleting request.body for GET.

Change-Id: I1cb72fadba80216ae7cb002b4c8bae9c34d78f5c
---
M lib/mw/ApiRequest.js
1 file changed, 3 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/cxserver 
refs/changes/58/378358/1

diff --git a/lib/mw/ApiRequest.js b/lib/mw/ApiRequest.js
index d540cad..be97281 100644
--- a/lib/mw/ApiRequest.js
+++ b/lib/mw/ApiRequest.js
@@ -48,8 +48,11 @@
                        }
                } );
                if ( method === 'get' ) {
+                       request.method = 'get';
                        request.query = query;
+                       delete request.body;
                } else if ( method === 'post' ) {
+                       request.method = 'post';
                        request.body = query;
                        request.headers[ 'content-type' ] = 
'application/x-www-form-urlencoded';
                }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1cb72fadba80216ae7cb002b4c8bae9c34d78f5c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/cxserver
Gerrit-Branch: master
Gerrit-Owner: Catrope <r...@wikimedia.org>

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

Reply via email to