You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this commit: 67871ac ngx-restangular was changed from using HttpClient's request method to the handle method of HttpBackend which bypasses the ability to use Angular's HTTP interceptors.
I looked around in issues, but didn't see a reason why this was done.
Unfortunately, for us, ngx-restangular's own interceptors aren't good enough for our use case, as they don't intercept every request (i.e. anything made with allUrl or oneUrl) and you can't abort the request (i.e. in the event that you want to return a cached response). Plus, extra config is necessary in order to take advantage of other Angular modules that do provide Angular interceptors (like the loading bar plugin that's mentioned in #144).
I forked the repo and just replaced a couple instances of HttpBackend and changed the handle method to request and plugged the built files into an app that we're migrating to ngx-restangular from restangular, and all seems to function the same, except now we can use native Angular interceptors (ngx-restangular interceptors still work though), and can just plug in the loading bar mentioned above without having to add custom code since all requests that ngx-restangular makes are going through HttpClient now.
This has the ability to fix #144, #95, #182 and perhaps others.
That said, I'm not sure why this support was removed (when both Angular interceptors and ngx-restangular interceptors appear to work fine) so just wanted to get some clarification on that before proposing the change from my fork as a PR.
Also, is there any sort of test suite? I've tested in our app, but that probably doesn't touch all of ngx-restangular's surface area. I see there's some karma config, but no specs. Is the "demo" app the best way to test changes?
Thanks!
The text was updated successfully, but these errors were encountered:
I'm in the middle of a migration from AngularJS and was wondering why the interceptors didn't work as before. As stated by @jaydiablo, there are many cases where the restangular's own interceptors dont fit.
I would like to know if there's any reason whatsoever or any update on this. Could it be a setting for the user if it's really needed? I think i'm going to use @jaydiablo 's fork for now, but since it's not on npm repo it also has its caveats.
It's really important to let people have interceptors to work.
Bunch of compatibility issues come out with disability of interceptors, and it discourages people for applying this module into their angular apps. Even for users have been using this dependency since the Angularjs era, i.e., myself.
In this commit: 67871ac ngx-restangular was changed from using
HttpClient
'srequest
method to thehandle
method ofHttpBackend
which bypasses the ability to use Angular's HTTP interceptors.I looked around in issues, but didn't see a reason why this was done.
Unfortunately, for us, ngx-restangular's own interceptors aren't good enough for our use case, as they don't intercept every request (i.e. anything made with
allUrl
oroneUrl
) and you can't abort the request (i.e. in the event that you want to return a cached response). Plus, extra config is necessary in order to take advantage of other Angular modules that do provide Angular interceptors (like the loading bar plugin that's mentioned in #144).I forked the repo and just replaced a couple instances of
HttpBackend
and changed thehandle
method torequest
and plugged the built files into an app that we're migrating to ngx-restangular from restangular, and all seems to function the same, except now we can use native Angular interceptors (ngx-restangular interceptors still work though), and can just plug in the loading bar mentioned above without having to add custom code since all requests that ngx-restangular makes are going throughHttpClient
now.Here's the fork: https://github.com/jaydiablo/ngx-restangular
And the specific commit where I've changed back to
HttpClient
: jaydiablo@9c09c3eThis has the ability to fix #144, #95, #182 and perhaps others.
That said, I'm not sure why this support was removed (when both Angular interceptors and ngx-restangular interceptors appear to work fine) so just wanted to get some clarification on that before proposing the change from my fork as a PR.
Also, is there any sort of test suite? I've tested in our app, but that probably doesn't touch all of ngx-restangular's surface area. I see there's some karma config, but no specs. Is the "demo" app the best way to test changes?
Thanks!
The text was updated successfully, but these errors were encountered: