mirror of
https://github.com/tenrok/axios.git
synced 2026-06-17 19:21:29 +03:00
847d89b436
* fix(buildURL): support URL object as input Fixes #6546 When passing a URL object (e.g., new URL(...)) to axios methods like axios.get(url, { params: {...} }), the buildURL function would crash with 'url.indexOf is not a function' because it assumed url was always a string. This fix converts URL objects to strings before processing. * fix: support URL object as config.url input - Move URL object coercion from buildURL to Axios._request so that all downstream consumers (buildFullPath, combineURLs, adapters) see a string. This fixes the crash when using URL object with baseURL (combineURLs calls .replace() on the URL object). - Remove the broken buildURL unit test that tested buildURL(url, null) without actually exercising URL coercion (buildURL early-returns when !params). - Add e2e tests via the HTTP adapter for URL object with params and URL object without params (no crash). * feat: note + example added under axios(url[, config]) documenting URL support * feat: url widened to string | URL * feat: oercion now uses config.url instanceof url * chore: add additional test cases to improve coverage * fix: apply suggestions from cubic review --------- Co-authored-by: liuwei53 <liuwei53@baidu.com> Co-authored-by: Jason Saayman <jasonsaayman@gmail.com>