mirror of
https://github.com/tenrok/axios.git
synced 2026-06-17 19:21:29 +03:00
@@ -6,6 +6,13 @@ var dispatchRequest = require('./core/dispatchRequest');
|
|||||||
var InterceptorManager = require('./core/InterceptorManager');
|
var InterceptorManager = require('./core/InterceptorManager');
|
||||||
|
|
||||||
var axios = module.exports = function (config) {
|
var axios = module.exports = function (config) {
|
||||||
|
// Allow for axios('example/url')
|
||||||
|
if (typeof config === 'string') {
|
||||||
|
config = {
|
||||||
|
url: config
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
config = utils.merge({
|
config = utils.merge({
|
||||||
method: 'get',
|
method: 'get',
|
||||||
headers: {},
|
headers: {},
|
||||||
|
|||||||
@@ -9,6 +9,19 @@ describe('requests', function () {
|
|||||||
jasmine.Ajax.uninstall();
|
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) {
|
it('should make an http request', function (done) {
|
||||||
var request;
|
var request;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user