Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling observables in interceptors #88

Closed
mrichar1 opened this issue Jul 17, 2017 · 2 comments
Closed

Handling observables in interceptors #88

mrichar1 opened this issue Jul 17, 2017 · 2 comments

Comments

@mrichar1
Copy link

mrichar1 commented Jul 17, 2017

I'm currently looking to use some methods in addResponseInterceptor function which return observables.

With the current code for getList explicitly raises an error if the resulting data is not an array:

if (!_.isArray(data)) {
throw new Error('Response for getList SHOULD be an array and not an object or something else');
}

This means that you can't use observables or promises in interceptors.

Additionally, I can't find a way to resolve the observable 'inside' the interceptor and have the actual data returned from the interceptor (though I am relatively new to observables/promises so might be missing something here).

@mrichar1
Copy link
Author

mrichar1 commented Aug 9, 2017

See also mgonto/restangular#1153

@rshchpkn
Copy link
Collaborator

rshchpkn commented Oct 9, 2017

Hello @mrichar1. Unfortunately you can't use observables or promises in response interceptors. It might be implemented in next major version of restangular.

@rshchpkn rshchpkn closed this as completed Oct 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants