vendredi 2 décembre 2016

Ember ignore route and make API call

I work on a project following a microservices architecture where I need to call from the frontend (Ember) a microservice in the https://localhost:5555/publisher/publish route.

This microservice will create a very big file (+1 GB) and send it back to the frontend, so Ajax in this case is out of the game because it will burn the RAM eventually (also the file would increase over time).

I've tried to use a link along with server support by setting the Content-Type and Content-Disposition headers accordingly in the microservice.

The problem is that the default Accept header by default in browsers is some variation of application/xml,application/xhtml+xml,text/html;q=0.9, text/plain;q=0.8,image/png,/;q=0.5, and with it Ember will interpret /publisher/publish as a route instead of doing the call to the microservice. If I change or remove the Accept header the call is done and I receive the file.

As I am not able to change the Accept headers in a link, is there any way of saying to Ember router to ignore a route and make an API call instead?




Aucun commentaire:

Enregistrer un commentaire