mediawiki.api.options: Use formatversion=2 for API requests
authorFomafix <fomafix@googlemail.com>
Thu, 11 Feb 2016 10:37:05 +0000 (10:37 +0000)
committerKrinkle <krinklemail@gmail.com>
Sat, 20 Feb 2016 20:52:55 +0000 (20:52 +0000)
The format of the JSON response does not change.
But the request is different so the test also have to be updated.

Change-Id: I391a221f81fd92731c331363a8202c21d6b933b5

resources/src/mediawiki/api/options.js
tests/qunit/suites/resources/mediawiki.api/mediawiki.api.options.test.js

index 9dd276d..bd6fa06 100644 (file)
@@ -55,6 +55,7 @@
                                } else {
                                        if ( value !== null ) {
                                                deferreds.push( this.postWithToken( 'options', {
+                                                       formatversion: 2,
                                                        action: 'options',
                                                        optionname: name,
                                                        optionvalue: value
@@ -62,6 +63,7 @@
                                        } else {
                                                // Omitting value resets the option
                                                deferreds.push( this.postWithToken( 'options', {
+                                                       formatversion: 2,
                                                        action: 'options',
                                                        optionname: name
                                                } ) );
@@ -71,6 +73,7 @@
 
                        if ( grouped.length ) {
                                deferreds.push( this.postWithToken( 'options', {
+                                       formatversion: 2,
                                        action: 'options',
                                        change: grouped
                                } ) );
index a0cfba9..a480671 100644 (file)
                this.server.respond( function ( request ) {
                        switch ( request.requestBody ) {
                                // simple
-                               case 'action=options&format=json&change=foo%3Dbar&token=%2B%5C':
+                               case 'action=options&format=json&formatversion=2&change=foo%3Dbar&token=%2B%5C':
                                // two options
-                               case 'action=options&format=json&change=foo%3Dbar%7Cbaz%3Dquux&token=%2B%5C':
+                               case 'action=options&format=json&formatversion=2&change=foo%3Dbar%7Cbaz%3Dquux&token=%2B%5C':
                                // not bundleable
-                               case 'action=options&format=json&optionname=foo&optionvalue=bar%7Cquux&token=%2B%5C':
-                               case 'action=options&format=json&optionname=bar&optionvalue=a%7Cb%7Cc&token=%2B%5C':
-                               case 'action=options&format=json&change=baz%3Dquux&token=%2B%5C':
+                               case 'action=options&format=json&formatversion=2&optionname=foo&optionvalue=bar%7Cquux&token=%2B%5C':
+                               case 'action=options&format=json&formatversion=2&optionname=bar&optionvalue=a%7Cb%7Cc&token=%2B%5C':
+                               case 'action=options&format=json&formatversion=2&change=baz%3Dquux&token=%2B%5C':
                                // reset an option
-                               case 'action=options&format=json&change=foo&token=%2B%5C':
+                               case 'action=options&format=json&formatversion=2&change=foo&token=%2B%5C':
                                // reset an option, not bundleable
-                               case 'action=options&format=json&optionname=foo%7Cbar%3Dquux&token=%2B%5C':
+                               case 'action=options&format=json&formatversion=2&optionname=foo%7Cbar%3Dquux&token=%2B%5C':
                                        assert.ok( true, 'Repond to ' + request.requestBody );
                                        request.respond( 200, { 'Content-Type': 'application/json' },
                                                '{ "options": "success" }' );