Alex Monk has uploaded a new change for review.
https://gerrit.wikimedia.org/r/273997
Change subject: Send Accept header to restbase
......................................................................
Send Accept header to restbase
TODO: Is this the correct value?
Bug: T128040
Change-Id: I77af4b58e5469a898063a3f838802e4f5769514b
---
M ApiVisualEditor.php
M modules/ve-mw/init/ve.init.mw.ArticleTargetLoader.js
2 files changed, 10 insertions(+), 5 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor
refs/changes/97/273997/1
diff --git a/ApiVisualEditor.php b/ApiVisualEditor.php
index 5f8371d..65cfb63 100644
--- a/ApiVisualEditor.php
+++ b/ApiVisualEditor.php
@@ -95,6 +95,7 @@
} else {
$request['body'] = $params;
}
+ $reqheaders['Accept'] =
'text/html;profile=mediawiki.org/specs/html/1.0.0';
$request['headers'] = $reqheaders;
$response = $this->serviceClient->run( $request );
if ( $response['code'] === 200 && $response['error'] === "" ) {
diff --git a/modules/ve-mw/init/ve.init.mw.ArticleTargetLoader.js
b/modules/ve-mw/init/ve.init.mw.ArticleTargetLoader.js
index 12ba171..6c106ac 100644
--- a/modules/ve-mw/init/ve.init.mw.ArticleTargetLoader.js
+++ b/modules/ve-mw/init/ve.init.mw.ArticleTargetLoader.js
@@ -139,17 +139,20 @@
fromEditedState = modified;
window.onbeforeunload = null;
$( window ).off( 'beforeunload' );
- restbaseXhr = $.post(
- conf.fullRestbaseUrl +
'v1/transform/wikitext/to/html/' +
+ restbaseXhr = $.ajax( {
+ url: conf.fullRestbaseUrl +
'v1/transform/wikitext/to/html/' +
encodeURIComponent(
pageName ) +
( oldid === undefined ?
'' : '/' + oldid ),
- {
+ type: 'POST',
+ data: {
title: pageName,
oldid: oldid,
wikitext: $(
'#wpTextbox1' ).val(),
stash: 'true'
- }
- );
+ },
+ headers: { Accept:
'text/html;profile=mediawiki.org/specs/html/1.0.0' },
+ dataType: 'text'
+ } );
} else {
if ( conf.fullRestbaseUrl ) {
pageHtmlUrl =
conf.fullRestbaseUrl + 'v1/page/html/';
@@ -160,6 +163,7 @@
url: pageHtmlUrl +
encodeURIComponent( pageName ) +
( oldid === undefined ?
'' : '/' + oldid ),
type: 'GET',
+ headers: { Accept:
'text/html;profile=mediawiki.org/specs/html/1.0.0' },
dataType: 'text'
} );
}
--
To view, visit https://gerrit.wikimedia.org/r/273997
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I77af4b58e5469a898063a3f838802e4f5769514b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Alex Monk <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits