提交 95f0f00c 编写于 作者: M mzabriskie

Fixing axios to treat single string argument as URL

closes #116
上级 eca2ac88
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册