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

Expose Axios client/module from the HttpService #842

Closed
ryanswart opened this issue Jul 4, 2018 · 6 comments
Closed

Expose Axios client/module from the HttpService #842

ryanswart opened this issue Jul 4, 2018 · 6 comments

Comments

@ryanswart
Copy link

I'm submitting a...


[ ] Regression 
[ ] Bug report
[x] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

The HttpService hides does not provide core Axios capabilities such as interceptors / transformers.

Expected behavior

Full access to Axios capabilities, by exposing the Axios instance used by the HttpModule. We could possibly also create new Axios clients for each HttpService instantiated, which will provide more granular control.

What is the motivation / use case for changing the behavior?

My primary use case is for debugging Axios requests, which is currently painful, as in a chain of requests, the logs do not specify where a request has failed. Adding an interceptor to the Axios instance would easily provide visibility into what is being requested and identify where the system is failing.

I'd be happy to pick this up if it makes sense

@cojack
Copy link
Contributor

cojack commented Jul 4, 2018

@ryanswart Hmmm why not just

import * as axios from 'axios'?

@ryanswart
Copy link
Author

ryanswart commented Jul 4, 2018

@cojack The HttpService doesn't end up using the global axios instance when I try it like that - ie. interceptors & defaults don't work. (and I want to use the module for the testing benefits it provides)

@kamilmysliwiec
Copy link
Member

The reference to the underlying axios package will be available through axiosRef property from the HttpService in the upcoming release.

@ryanswart
Copy link
Author

Great thanks! Should I close the issue?

@kamilmysliwiec
Copy link
Member

Added in v5.1.0

@lock
Copy link

lock bot commented Sep 24, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Sep 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants