Lucas_Werkmeister_WMDE added a comment.
Note: Though the error message looks identical, this doesn’t come from
Wikibase’s `ContentTypeCheckMiddleware`; with a debugger, I could instead see
that it comes from `\MediaWiki\Rest\Handler::parseBodyData()`:
/**
* @throws HttpException on failed check
*/
public function parseBodyData( RequestInterface $request ): ?array {
// Parse the body based on its content type
$contentType = $request->getBodyType();
switch ( $contentType ) {
case 'application/x-www-form-urlencoded':
case 'multipart/form-data':
return $request->getPostParams();
case 'application/json':
$jsonStream = $request->getBody();
$parsedBody = json_decode( "$jsonStream", true
);
if ( !is_array( $parsedBody ) ) {
throw new LocalizedHttpException(
// Fixme: missing parameter
new MessageValue(
'rest-json-body-parse-error', [ "" ] ),
400
);
}
return $parsedBody;
default:
throw new LocalizedHttpException( // <== HERE
new MessageValue(
'rest-unsupported-content-type', [ $contentType ?? '(null)' ] ),
415
);
}
}
TASK DETAIL
https://phabricator.wikimedia.org/T359149
EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Lucas_Werkmeister_WMDE
Cc: Lucas_Werkmeister_WMDE, Aklapper, Jakob_WMDE, Danny_Benjafield_WMDE,
Isabelladantes1983, Themindcoder, Adamm71, Jersione, Hellket777, LisafBia6531,
Astuthiodit_1, 786, Biggs657, karapayneWMDE, Invadibot, maantietaja, Juan90264,
Alter-paule, Beast1978, ItamarWMDE, Un1tY, Akuckartz, apaskulin, Hook696,
Kent7301, joker88john, CucyNoiD, Nandana, Gaboe420, Giuliamocci, Cpaulf30,
Lahi, Gq86, Af420, Xinbenlv, Bsandipan, GoranSMilovanovic, QZanden, KimKelting,
LawExplorer, Lewizho99, Maathavan, _jensen, rosalieper, Neuronton, Scott_WUaS,
Wikidata-bugs, aude, Jdforrester-WMF, Mbch331
_______________________________________________
Wikidata-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]