Patch for rest api

This commit is contained in:
GOLEM 2019-08-20 00:41:47 +02:00
parent a1263dbe1f
commit f34c1fcee6
1 changed files with 5 additions and 2 deletions

View File

@ -8,6 +8,8 @@
use MediaWiki\Logger\LoggerFactory;
const WikiMediaServersReturnInvalidErrorCodes = true;
class MathRestbaseInterface {
private $hash = false;
private $tex;
@ -364,7 +366,7 @@ class MathRestbaseInterface {
*/
public function evaluateRestbaseCheckResponse( $response ) {
$json = json_decode( $response['body'] );
if ( $response['code'] === 200 ) {
if ( $response['code'] === 200 || WikiMediaServersReturnInvalidErrorCodes ) {
$headers = $response['headers'];
$this->hash = $headers['x-resource-location'];
$this->success = $json->success;
@ -418,7 +420,7 @@ class MathRestbaseInterface {
* @throws MWException
*/
private function evaluateContentResponse( $type, $response, $request ) {
if ( $response['code'] === 200 ) {
if ( $response['code'] === 200 || WikiMediaServersReturnInvalidErrorCodes ) {
if ( array_key_exists( 'x-mathoid-style', $response['headers'] ) ) {
$this->mathoidStyle = $response['headers']['x-mathoid-style'];
}
@ -453,3 +455,4 @@ class MathRestbaseInterface {
throw new MWException( "Cannot get $type. $detail" );
}
}