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

Bug: T131171
Change-Id: I385ef1f3efb674c4ad3ffb334c0ff5b830f89a37
This commit is contained in:
Alex Monk 2016-03-30 01:05:50 +01:00
parent d4d1f10b95
commit 1c455a5fb8

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'] === "" ) {