Never return undefined from RepoApi.normalizeMultiValue

Authored by thiemowmde on Jul 17 2017, 11:17 AM.

Description

Never return undefined from RepoApi.normalizeMultiValue

Note how "undefined" is strictly forbidden in the "_post" method, see
line #885:

if ( value === undefined … ) {
    throw new Error( …

This was the error that made the browser tests fail in Ib1b9e30, even
if MediaWiki core and the Wikibase API module would have been fine with
unused parameters set to "undefined".

I would go so far and call this an actual bug in this class. The private
method "normalizeMultiValue" turns empty strings into "undefined", but this
is guaranteed to fail in the private "_post" method. The only way to work
around this was to provide empty arrays instead of empty strings (which is
what actually happens in production code). This should be consistent.

Change-Id: I84d360f7532c28353aff39baa791cbeffe7b6768

Details

Committed
thiemowmdeJul 17 2017, 11:26 AM
Parents
rEWBJ0025fe724054: Merge "Lint JS with eslint"
Branches
Unknown
Tags
Unknown
References
refs/changes/81/365581/1
ChangeId
I84d360f7532c28353aff39baa791cbeffe7b6768