Merge "Set User-Agent in server-side VRS requests to RESTBase/Parsoid"

This commit is contained in:
jenkins-bot 2016-03-31 08:39:00 +00:00 committed by Gerrit Code Review
commit 98cf88a205

View file

@ -86,6 +86,7 @@ class ApiVisualEditor extends ApiBase {
} }
private function requestRestbase( $method, $path, $params, $reqheaders = [] ) { private function requestRestbase( $method, $path, $params, $reqheaders = [] ) {
global $wgVersion;
$request = [ $request = [
'method' => $method, 'method' => $method,
'url' => '/restbase/local/v1/' . $path 'url' => '/restbase/local/v1/' . $path
@ -97,6 +98,7 @@ class ApiVisualEditor extends ApiBase {
} }
// Should be synchronised with modules/ve-mw/init/ve.init.mw.ArticleTargetLoader.js // Should be synchronised with modules/ve-mw/init/ve.init.mw.ArticleTargetLoader.js
$reqheaders['Accept'] = 'text/html; charset=utf-8; profile="mediawiki.org/specs/html/1.2.0"'; $reqheaders['Accept'] = 'text/html; charset=utf-8; profile="mediawiki.org/specs/html/1.2.0"';
$reqheaders['User-Agent'] = 'VisualEditor-MediaWiki/' . $wgVersion;
$request['headers'] = $reqheaders; $request['headers'] = $reqheaders;
$response = $this->serviceClient->run( $request ); $response = $this->serviceClient->run( $request );
if ( $response['code'] === 200 && $response['error'] === "" ) { if ( $response['code'] === 200 && $response['error'] === "" ) {