mirror of
https://github.com/tenrok/axios.git
synced 2026-06-08 17:22:34 +03:00
Fixing combineURLs to support an empty relativeURL (#581)
* Fixing combineURLs to support an empty relativeURL When combining the base and relative URLs, we should forego force appending a slash to the base when the relative URL is empty. This leads to a semantic url. * Fixing combineURLs, allowing single slash relatives
This commit is contained in:
committed by
Nick Uraltsev
parent
cfe33d4fd3
commit
fe7d09bb08
@@ -12,4 +12,12 @@ describe('helpers::combineURLs', function () {
|
||||
it('should insert missing slash', function () {
|
||||
expect(combineURLs('https://api.github.com', 'users')).toBe('https://api.github.com/users');
|
||||
});
|
||||
|
||||
it('should not insert slash when relative url missing/empty', function () {
|
||||
expect(combineURLs('https://api.github.com/users', '')).toBe('https://api.github.com/users');
|
||||
});
|
||||
|
||||
it('should allow a single slash for relative url', function () {
|
||||
expect(combineURLs('https://api.github.com/users', '/')).toBe('https://api.github.com/users/');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user