mirror of
https://github.com/tenrok/axios.git
synced 2026-05-15 11:59:42 +03:00
@@ -6,6 +6,13 @@ var dispatchRequest = require('./core/dispatchRequest');
|
||||
var InterceptorManager = require('./core/InterceptorManager');
|
||||
|
||||
var axios = module.exports = function (config) {
|
||||
// Allow for axios('example/url')
|
||||
if (typeof config === 'string') {
|
||||
config = {
|
||||
url: config
|
||||
};
|
||||
}
|
||||
|
||||
config = utils.merge({
|
||||
method: 'get',
|
||||
headers: {},
|
||||
|
||||
@@ -9,6 +9,19 @@ describe('requests', function () {
|
||||
jasmine.Ajax.uninstall();
|
||||
});
|
||||
|
||||
it('should treat single string arg as url', function (done) {
|
||||
var request;
|
||||
|
||||
axios('/foo');
|
||||
|
||||
setTimeout(function () {
|
||||
request = jasmine.Ajax.requests.mostRecent();
|
||||
|
||||
expect(request.url).toBe('/foo');
|
||||
done();
|
||||
}, 0);
|
||||
});
|
||||
|
||||
it('should make an http request', function (done) {
|
||||
var request;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user