mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 02:23:58 +00:00
Merge "Set User-Agent in server-side VRS requests to RESTBase/Parsoid"
This commit is contained in:
commit
98cf88a205
|
@ -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'] === "" ) {
|
||||||
|
|
Loading…
Reference in a new issue