perf:全局配置prefix
This commit is contained in:
@@ -49,6 +49,7 @@ const request = extend({
|
|||||||
*/
|
*/
|
||||||
let httpConfig = {
|
let httpConfig = {
|
||||||
encryptBody: true,
|
encryptBody: true,
|
||||||
|
prefix: "",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -86,6 +87,9 @@ const dealParamsBody = (options) => {
|
|||||||
* @returns {Promise<<any>>}
|
* @returns {Promise<<any>>}
|
||||||
*/
|
*/
|
||||||
async function req(url, options) {
|
async function req(url, options) {
|
||||||
|
if (httpConfig.prefix) {
|
||||||
|
url = httpConfig.prefix + url;
|
||||||
|
}
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
request(url, {
|
request(url, {
|
||||||
...dealParamsBody(options),
|
...dealParamsBody(options),
|
||||||
|
|||||||
Reference in New Issue
Block a user