mirror of
https://github.com/tenrok/axios.git
synced 2026-06-20 20:00:40 +03:00
fix(http): treat http://localhost as base URL for relative paths to avoid ERR_INVALID_URL error; (#5528)
This commit is contained in:
@@ -183,7 +183,7 @@ export default isHttpAdapterSupported && function httpAdapter(config) {
|
|||||||
|
|
||||||
// Parse url
|
// Parse url
|
||||||
const fullPath = buildFullPath(config.baseURL, config.url);
|
const fullPath = buildFullPath(config.baseURL, config.url);
|
||||||
const parsed = new URL(fullPath);
|
const parsed = new URL(fullPath, 'http://localhost');
|
||||||
const protocol = parsed.protocol || supportedProtocols[0];
|
const protocol = parsed.protocol || supportedProtocols[0];
|
||||||
|
|
||||||
if (protocol === 'data:') {
|
if (protocol === 'data:') {
|
||||||
|
|||||||
Reference in New Issue
Block a user