perf:全局配置prefix

This commit is contained in:
曾文豪
2023-03-16 18:23:42 +08:00
parent 053cd1334a
commit c384f74252

View File

@@ -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),