mirror of
https://github.com/tenrok/axios.git
synced 2026-06-20 20:00:40 +03:00
Add getUri method (#1712)
* Added getUri method * Removed usage of "url" * added method to README
This commit is contained in:
committed by
Emily Morehouse
parent
38de25257c
commit
4f98acc578
@@ -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
|
||||
|
||||
|
||||
@@ -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');
|
||||
@@ -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*/
|
||||
|
||||
Reference in New Issue
Block a user