Describe the bug
When baseURL is an absolute URL with path part included (e.g. http://example.com/foo) and url is relative URL (e.g. /bar) the logged URL does not include the path part of the baseURL (i.e. /foo) while Axios calls the correct URL.
In other words:
Axios calls: http://example.com/foo/bar
The log shows: http://example.com/bar (/foo is missing)
Related bug: #140 (probably should be fixed together as they both caused by the same URL-combining function).
I think new URL(relativeURL, baseURL) is wrong tool to combine URLs to produce the same URL as Axios does.
A failing test
test('combineURLs should combine the base URL with the relative URL when base URL has a path', () => {
const sb = new StringBuilder(getGlobalConfig());
const result = sb.combineURLs('https://github.com/users', '/hg-pyun');
expect(result).toBe('https://github.com/users/hg-pyun');
});
Describe the bug When
baseURL
is an absolute URL withpath
part included (e.g.http://example.com/foo
) andurl
is relative URL (e.g./bar
) the logged URL does not include thepath
part of thebaseURL
(i.e./foo
) while Axios calls the correct URL.In other words: Axios calls:
http://example.com/foo/bar
The log shows:http://example.com/bar
(/foo
is missing)To Reproduce
Expected behavior
Actual behavior
Additional Context
Related bug: #140 (probably should be fixed together as they both caused by the same URL-combining function).
I think
new URL(relativeURL, baseURL)
is wrong tool to combine URLs to produce the same URL as Axios does.A failing test