Skip to content

Commit

Permalink
Merge pull request #461 from theikkila/master
Browse files Browse the repository at this point in the history
Add OPTIONS-method as a shortcut
  • Loading branch information
nickuraltsev committed Mar 27, 2017
2 parents 5630d3b + 8cdfcd0 commit 2fe9562
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -140,6 +140,7 @@ For convenience aliases have been provided for all supported request methods.
##### axios.get(url[, config])
##### axios.delete(url[, config])
##### axios.head(url[, config])
##### axios.options(url[, config])
##### axios.post(url[, data[, config]])
##### axios.put(url[, data[, config]])
##### axios.patch(url[, data[, config]])
Expand Down Expand Up @@ -176,6 +177,7 @@ The available instance methods are listed below. The specified config will be me
##### axios#get(url[, config])
##### axios#delete(url[, config])
##### axios#head(url[, config])
##### axios#options(url[, config])
##### axios#post(url[, data[, config]])
##### axios#put(url[, data[, config]])
##### axios#patch(url[, data[, config]])
Expand Down
2 changes: 1 addition & 1 deletion lib/core/Axios.js
Expand Up @@ -61,7 +61,7 @@ Axios.prototype.request = function request(config) {
};

// Provide aliases for supported request methods
utils.forEach(['delete', 'get', 'head'], function forEachMethodNoData(method) {
utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
/*eslint func-names:0*/
Axios.prototype[method] = function(url, config) {
return this.request(utils.merge(config || {}, {
Expand Down
2 changes: 2 additions & 0 deletions test/specs/api.spec.js
Expand Up @@ -3,6 +3,7 @@ describe('static api', function () {
expect(typeof axios.request).toEqual('function');
expect(typeof axios.get).toEqual('function');
expect(typeof axios.head).toEqual('function');
expect(typeof axios.options).toEqual('function');
expect(typeof axios.delete).toEqual('function');
expect(typeof axios.post).toEqual('function');
expect(typeof axios.put).toEqual('function');
Expand Down Expand Up @@ -48,6 +49,7 @@ describe('instance api', function () {
it('should have request methods', function () {
expect(typeof instance.request).toEqual('function');
expect(typeof instance.get).toEqual('function');
expect(typeof instance.options).toEqual('function');
expect(typeof instance.head).toEqual('function');
expect(typeof instance.delete).toEqual('function');
expect(typeof instance.post).toEqual('function');
Expand Down

0 comments on commit 2fe9562

Please sign in to comment.