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
Fix moxios by not forcing adapters to resolve baseURL #2751
Conversation
The changes of config is one of the most annoying things in axios. It happens in several files, and no clear documents record them. I think we should reach a consensus first, and write lots of tests to cover as more cases as possible. In adapters, I agree that they should not care about things like combining |
✨ This is an old work account. Please reference @brandonchinn178 for all future communication ✨
I say wait until we see a use case. If one comes up, we could always add a |
Any decision made for that? Can I help somehow? |
@brandon-leapyear Can you add a test case for #1628? I don't think you kept that. Because @floriangosse You can help test or give any opinions you have. We are glad to hear more suggestions. |
✨ This is an old work account. Please reference @brandonchinn178 for all future communication ✨ The PR fixing #1628 added a test that I didn't change |
@brandon-leapyear That's why CI is failed now. |
✨ This is an old work account. Please reference @brandonchinn178 for all future communication ✨ @chinesedfan ah got it. How does that fix look? |
@brandon-leapyear I realized that #1628 was the case. Now the test passed but was not satisfied with #1628. Adding |
✨ This is an old work account. Please reference @brandonchinn178 for all future communication ✨ @chinesedfan the more I think about this, the more I think avoiding config modification is the correct solution. Then, the error that interceptors receive could have both the It solves #1628 in the sense that the original goal was to rerun the request, using the same config initially passed into the request. This goes beyond the baseURL/url issue; even after "solving" #1628 with the initial solution, config modifications would happen twice, e.g. |
✨ This is an old work account. Please reference @brandonchinn178 for all future communication ✨ Blocked by #2798 |
I think it should be consistent because many adapters rely on |
any updates on this? |
A recent code change to moxios now takes into account |
Holy shit! It's @mzabriskie. Will you come back to lead axios or give me 30mins to discuss its future? You can find me on GitHub/Gitter and slacks. |
✨ This is an old work account. Please reference @brandonchinn178 for all future communication ✨ ah thanks @mzabriskie. This PR can be closed, in that case, although I highly recommend #2798 anyway, to avoid modifying configs as it gets passed around |
Closing |
✨ This is an old work account. Please reference @brandonchinn178 for all future communication ✨
Fixes #2650
Adapters should not have to care about
baseURL
; everything should be fully resolved by the point it gets to the adapter. The original PR (#2391) broke moxios tests that usedbaseURL
in the production code, but stubbed requests using full URLs.This PR should maintain the behavior the first PR set out to fix (namely, that the config URL is not modified) while allowing adapters to have the same behavior as before the first PR. In general, I recommend not modifying the config at all in
dispatchRequest
, but this fix should suffice for the issue above