On before ajax listener

Hi, I wanted to set header of request. Following code sets the header:

webix.attachEvent(“onBeforeAjax”, (mode, url, data, request, headers, files, promise) => {
if (url.includes(“import”) || url.includes(“uploadFile”)) {
headers[“X-Auth-Token”] = getToken(); }
});

However, it cannot catch this url in the listener above
http://localhost:8081/api/files/downloadFile/1/qqq.svg

@Yryskul

However, it cannot catch this url in the listener above
http://localhost:8081/api/files/downloadFile/1/qqq.svg
do not you have a typo?
your url does not include neither “import” nor “uploadFile”.

No. When browser request this http://localhost:8081/api/files/downloadFile/1/qqq.svg link, it does not fall into OnBeforeAjax listener.

No. When browser request this
is it browser request or XmlHttpRequest (ajax)?
only webix ajax requests are processed by onBeforeAjax handler

Hi @integral, it is browser request.

@Yryskul

it is browser request.
then it is normal that request is not handled by onBeforeAjax as it is not webix ajax request.
at the moment it is not possible to set headers in requests like img->src

@integral Thanks.