mediawiki.ForeignApi: Use `type === 'POST'` instead of `type !== 'GET'`
authorBartosz Dziewoński <matma.rex@gmail.com>
Sat, 29 Aug 2015 18:44:08 +0000 (20:44 +0200)
committerBartosz Dziewoński <matma.rex@gmail.com>
Sat, 29 Aug 2015 18:44:08 +0000 (20:44 +0200)
Works better when 'type' is not set (which can happen if someone is
calling #ajax directly rather than #get or #post), is consistent
with code in mediawiki.api, and better reflects what we really mean.

Change-Id: Iea265be5c0e6113e91e700124ac36a0b588ca25c

resources/src/mediawiki.api/mediawiki.ForeignApi.js

index 74e80e2..b8cc059 100644 (file)
@@ -90,7 +90,7 @@
                var url, origin, newAjaxOptions;
 
                // 'origin' query parameter must be part of the request URI, and not just POST request body
-               if ( ajaxOptions.type !== 'GET' ) {
+               if ( ajaxOptions.type === 'POST' ) {
                        url = ( ajaxOptions && ajaxOptions.url ) || this.defaults.ajax.url;
                        origin = ( parameters && parameters.origin ) || this.defaults.parameters.origin;
                        url += ( url.indexOf( '?' ) !== -1 ? '&' : '?' ) +