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