maybe you can try to override the sendRequest method using javascript means or you directly patch the xtext js files
(i am not a javascript wizard)
require(["webjars/ace/1.3.3/src/ace"], function() {
require(["xtext/xtext-ace"], function(xtext) {
var cs = xtext.createServices;
if (cs) {
xtext.createServices = function(editor, options) {
const s = cs.call(this, editor, options);
for (const property in s) {
const oldSendRequest = s[property].sendRequest;
if (oldSendRequest) {
editor.xtextServices[property].sendRequest = function(editorContext, settings, needsSession) {
self = this;
settings.data.dullydully="Hello";
oldSendRequest.call(self, editorContext, settings, needsSession);
}
}
}
return s;
}
}
var editor = xtext.createEditor({
baseUrl: baseUrl,
syntaxDefinition: "xtext-resources/generated/mode-mydsl"
});
});
});
or does the token need to be send in header?
then maybe something like
//assuming this does not strip anything, otherwise maybe call original beforeSend
settings.beforeSend = function(xhr){xhr.setRequestHeader('X-Test-Header', 'test-value');};
maybe you can also do it globally with
$.ajaxSetup({
beforeSend: function(xhr) {
xhr.setRequestHeader('X-Test-Header', '...');
}
});
[Updated on: Thu, 18 May 2023 08:46]
Report message to a moderator