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

Simplifying redundant config merge. #1367

Conversation

emilyemorehouse
Copy link
Member

I noticed this when reviewing #1342/#723.

When Axios is configured either as an instance here or when used normally here, defaults is already part of this.defaults and therefore, it's redundant to merge with defaults again in the instance request method.

Can someone check this and confirm?
(@rubennorte you were involved in the original issue, this should be an easy one for you to check out).

@emilyemorehouse
Copy link
Member Author

Ehh nevermind, this does break. I'd love an explanation though!

@DavidRueter
Copy link

It may be that this change broke something else: Now when creating an instance, the config that is passed to the constructor is NOT respected. For example:

const ax = axios.create(myconfig);
ax.request();

...will fail, because the values from myconfig are not actually present.

On the other hand, this works:

const ax = axios.create();
ax.request(myconfig);

If this change is intentional, the documentation should be updated: https://github.com/axios/axios#creating-an-instance

@emilyemorehouse
Copy link
Member Author

This PR wasn't actually merged -- are you using the 0.19 beta? There were config changes that could be causing this (and if so, I'd love to track it down and fix it because it's not intentional).

@DavidRueter
Copy link

Yes, I am on v0.19.0-beta.1 Let me know if I can help. I'm not all that familiar with axios however.

@axios axios locked and limited conversation to collaborators May 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants