Page 1 of 1

[ANGULAR] Change Sync (CRUD Manager) request type from Fetch to XHR

Posted: Fri Aug 19, 2022 10:15 pm
by victor.lacerda

Hello!
Is it possible to make CRUD Manager perform XML HTTP Requests (XHR) instead of using Fetch API?
On our setup we have an Angular application in which CRUD Manager makes fetch requests that are sent to our Node proxy. We noticed the request hits the proxy but doesn't hit our Gateway microservice. Therefore it fails to reach our Service microservice behind the Gateway.


Re: [ANGULAR] Change Sync (CRUD Manager) request type from Fetch to XHR

Posted: Sat Aug 20, 2022 9:12 am
by mats

Sounds like something that would be easier to fix in your backend..? XHR is legacy these days and the fetch API is so much simpler to work with.

It's not supported out of the box, but if you really want to try changing this, you can study the code in AjaxTransport.js

    sendRequest(request) {

Which calls

            ajaxPromise = AjaxHelper.fetch(requestConfig.url, fetchOptions);

You could try overriding AjaxHelper.fetch to use XHR instead perhaps.


Re: [ANGULAR] Change Sync (CRUD Manager) request type from Fetch to XHR

Posted: Mon Aug 22, 2022 7:20 pm
by victor.lacerda

Understood Mats, thanks for your feedback, we will debug the communication between our front-end and back-end. I we are not able to find the root of the problem, we will use XHR instead by Overriding the method.