fix(dianziqian): 处理url (#1531)

Co-authored-by: sealday <zhanglin@daoyoucloud.com>
Co-authored-by: TomyJan <tomyjan6@gmail.com>
Reviewed-on: daoyoucloud/tachybase#1531
Co-authored-by: wanggang <1366376228@qq.com>
Co-committed-by: wanggang <1366376228@qq.com>
This commit is contained in:
wanggang 2024-09-11 17:53:30 +08:00 committed by TomyJan
parent 0aca5ef9a3
commit db69917a6e

View File

@ -97,11 +97,6 @@ async function request(config, context) {
if (key === 'file') { if (key === 'file') {
let { url: resourceUrl, params: resourceParams, headers: resourceHeader, body: resourceBody } = data[key]; let { url: resourceUrl, params: resourceParams, headers: resourceHeader, body: resourceBody } = data[key];
resourceUrl = resourceUrl?.trim() || ''; resourceUrl = resourceUrl?.trim() || '';
if (!resourceUrl.startsWith('http')) {
//如果开头不是http默认该url是内部url,需要加上token
resourceUrl = `${origin}${resourceUrl}`;
resourceHeader.Authorization = 'Bearer ' + token
}
if (resourceHeader['Content-Type'] === 'multipart/form-data' && resourceBody) { if (resourceHeader['Content-Type'] === 'multipart/form-data' && resourceBody) {
//resource contentType类型 //resource contentType类型