Null URLs fallback on '' which has a different behavior
Hi,
Just wanted to flag that this PR introduced a breaking change in lib/helpers/buildURL.js.
Previously, when url was null, axios.get(null) would not send a request. Now, since buildURL does url = url || '', a null URL is silently coerced into an empty string, and axios.get('') resolves to a relative URL — meaning axios ends up making a request against the current page's URL.
This effectively removes the distinction between null and '': they used to be handled differently (a null URL failed fast, while an empty string was already treated as a valid relative path), and now they behave identically. It would be great if that distinction could be reintroduced, so passing null/undefined doesn't silently trigger a request rather than throwing or failing early.
This change shipped in a patch release (1.18.1), and it broke some of our apps. Fortunately our QA caught it before it reached production. No drama here — just wanted to give a heads-up, since this could affect other axios users too. If anyone runs into pages crashing on unexpected requests that used to work fine, this might be why.
One last note, unrelated to the bug itself: it would help to keep PRs as small and focused as possible — bundling 14 issues into a single PR makes it harder to review and to spot regressions like this one, especially for a repo as widely used as axios.
Love axios though — hope you can keep the package safe from all the evil out there! <3
Source: axios/axios