api: Better error when 'wikitext' parameter is required

Bug: T280072
Change-Id: Ibd03aa2a527ac2d27ef7c3dbaf25df74a2a0fdc5
This commit is contained in:
Bartosz Dziewoński 2021-04-14 16:05:36 +02:00
parent 43c1ec5f42
commit aec35a67d0

View file

@ -542,6 +542,9 @@ class ApiVisualEditor extends ApiBase {
case 'parsedoc':
case 'parsefragment':
$wikitext = $params['wikitext'];
if ( $wikitext === null ) {
$this->dieWithError( [ 'apierror-missingparam', 'wikitext' ] );
}
$bodyOnly = ( $params['paction'] === 'parsefragment' );
if ( $params['pst'] ) {
$wikitext = $this->pstWikitext( $title, $wikitext );