List of steps to reproduce (step by step, including full links if applicable):
If any value passed contains the pipe character (|), use the alternative multiple-value separator for correct operation.
..
api = new mw.Api; api.postWithEditToken( {format: 'json', action: 'options', change:'userjs-Test=%1F{"foo1":{},"foo2":{},"foo3":"[[link|name]]"}' } ).then( function ( data ) { console.log(data);});
reload page
mw.user.options.get('userjs-Test')
What happens?:
"%1F{\"foo1\":{},\"foo2\":{},\"foo3\":\"[[link"
What should have happened instead?:
"{\"foo1\":{},\"foo2\":{},\"foo3\":\"[[link|name]]"}"