Skip to content

Commit

Permalink
Add getUri method (#1712)
Browse files Browse the repository at this point in the history
* Added getUri method

* Removed usage of "url"

* added method to README
  • Loading branch information
anthonygauthier authored and emilyemorehouse committed Aug 7, 2018
1 parent 38de252 commit 4f98acc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -218,6 +218,7 @@ The available instance methods are listed below. The specified config will be me
##### axios#post(url[, data[, config]])
##### axios#put(url[, data[, config]])
##### axios#patch(url[, data[, config]])
##### axios#getUri([config])

## Request Config

Expand Down
6 changes: 6 additions & 0 deletions lib/core/Axios.js
@@ -1,6 +1,7 @@
'use strict';

var utils = require('./../utils');
var buildURL = require('../helpers/buildURL');
var InterceptorManager = require('./InterceptorManager');
var dispatchRequest = require('./dispatchRequest');
var mergeConfig = require('./mergeConfig');
Expand Down Expand Up @@ -55,6 +56,11 @@ Axios.prototype.request = function request(config) {
return promise;
};

Axios.prototype.getUri = function getUri(config) {
config = mergeConfig(this.defaults, config);
return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\?/, '');
};

// Provide aliases for supported request methods
utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
/*eslint func-names:0*/
Expand Down

0 comments on commit 4f98acc

Please sign in to comment.