mirror of
https://github.com/tenrok/axios.git
synced 2026-06-23 20:40: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#post(url[, data[, config]])
|
||||||
##### axios#put(url[, data[, config]])
|
##### axios#put(url[, data[, config]])
|
||||||
##### axios#patch(url[, data[, config]])
|
##### axios#patch(url[, data[, config]])
|
||||||
|
##### axios#getUri([config])
|
||||||
|
|
||||||
## Request Config
|
## Request Config
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var utils = require('./../utils');
|
var utils = require('./../utils');
|
||||||
|
var buildURL = require('../helpers/buildURL');
|
||||||
var InterceptorManager = require('./InterceptorManager');
|
var InterceptorManager = require('./InterceptorManager');
|
||||||
var dispatchRequest = require('./dispatchRequest');
|
var dispatchRequest = require('./dispatchRequest');
|
||||||
var mergeConfig = require('./mergeConfig');
|
var mergeConfig = require('./mergeConfig');
|
||||||
@@ -55,6 +56,11 @@ Axios.prototype.request = function request(config) {
|
|||||||
return promise;
|
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
|
// Provide aliases for supported request methods
|
||||||
utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
|
utils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {
|
||||||
/*eslint func-names:0*/
|
/*eslint func-names:0*/
|
||||||
|
|||||||
Reference in New Issue
Block a user