fix: original url containe empty strings (#1414)
Co-authored-by: sealday <sealday@gmail.com> Reviewed-on: daoyoucloud/tachybase#1414
This commit is contained in:
parent
4cee56eed7
commit
2666fc045c
@ -18,8 +18,9 @@ export type RequestConfig = Pick<AxiosRequestConfig, 'url' | 'method' | 'params'
|
|||||||
async function request(config, context) {
|
async function request(config, context) {
|
||||||
// default headers
|
// default headers
|
||||||
const { token, origin } = context;
|
const { token, origin } = context;
|
||||||
const { url: originUrl, method = 'POST', data, timeout = 5000 } = config;
|
const { method = 'POST', data, timeout = 5000 } = config;
|
||||||
|
|
||||||
|
const originUrl = (config.url?.url || '').trim();
|
||||||
const url = originUrl.startsWith('http') ? originUrl : `${origin}${originUrl}`;
|
const url = originUrl.startsWith('http') ? originUrl : `${origin}${originUrl}`;
|
||||||
|
|
||||||
let headers = (config.headers ?? []).reduce((result, header) => {
|
let headers = (config.headers ?? []).reduce((result, header) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user