mirror of
https://github.com/tenrok/axios.git
synced 2026-06-14 18:42:33 +03: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
This commit is contained in:
committed by
Felipe Martins
parent
98e4acd893
commit
6fe506fda2
@@ -245,6 +245,30 @@ describe('requests', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('should not modify the config url with relative baseURL', function (done) {
|
||||
var config;
|
||||
|
||||
axios.get('/foo', {
|
||||
baseURL: '/api'
|
||||
}).catch(function (error) {
|
||||
config = error.config;
|
||||
});
|
||||
|
||||
getAjaxRequest().then(function (request) {
|
||||
request.respondWith({
|
||||
status: 404,
|
||||
statusText: 'NOT FOUND',
|
||||
responseText: 'Resource not found'
|
||||
});
|
||||
|
||||
setTimeout(function () {
|
||||
expect(config.baseURL).toEqual('/api');
|
||||
expect(config.url).toEqual('/foo');
|
||||
done();
|
||||
}, 100);
|
||||
});
|
||||
});
|
||||
|
||||
it('should allow overriding Content-Type header case-insensitive', function (done) {
|
||||
var response;
|
||||
var contentType = 'application/vnd.myapp.type+json';
|
||||
|
||||
Reference in New Issue
Block a user