mirror of
https://github.com/axios/axios.git
synced 2026-04-16 15:56:02 +08:00
* Adding tests to show config.url mutation Because config.url is modified while processing the request when the baseURL is set, it is impossible to perform a retry with the provided config object. Ref #1628 * Fixing url combining without modifying config.url As config.url is not modified anymore during the request processing. The request can safely be retried after it failed with the provided config. resolves #1628
21 lines
816 B
JavaScript
21 lines
816 B
JavaScript
var buildFullPath = require('../../../lib/core/buildFullPath');
|
|
|
|
describe('helpers::buildFullPath', function () {
|
|
it('should combine URLs when the requestedURL is relative', function () {
|
|
expect(buildFullPath('https://api.github.com', '/users')).toBe('https://api.github.com/users');
|
|
});
|
|
|
|
it('should return the requestedURL when it is absolute', function () {
|
|
expect(buildFullPath('https://api.github.com', 'https://api.example.com/users')).toBe('https://api.example.com/users');
|
|
});
|
|
|
|
it('should not combine URLs when the baseURL is not configured', function () {
|
|
expect(buildFullPath(undefined, '/users')).toBe('/users');
|
|
});
|
|
|
|
it('should combine URLs when the baseURL and requestedURL are relative', function () {
|
|
expect(buildFullPath('/api', '/users')).toBe('/api/users');
|
|
});
|
|
|
|
});
|