aurelia / http-client

A simple, restful, message-based wrapper around XMLHttpRequest.
MIT License
62 stars 59 forks source link

Something like $.ajaxPrefilter() #89

Closed Zensavona closed 9 years ago

Zensavona commented 9 years ago

Hi guys, this is more a feature request than an issue.

I'd love a way of being able to sanely filter request responses in a similar way to jQuery.ajaxPrefilter(). The use case is looking for things like 401s and determining login state on each request - is there currently a hook for doing this I'm unaware of? The only way I'm aware of is wrapping the request methods in some way, which seems a bit ugly.

Thoughts?

Thanks :heart:

bryanrsmith commented 9 years ago

You should be able to accomplish this with an interceptor. Check out the documentation at http://aurelia.io/docs.html#interceptors and let us know if that doesn't meet your needs.

Zensavona commented 9 years ago

Perfect. Thanks @bryanrsmith!