[inula-request]<feat> 请求组件支持在响应体中获取完整 URL
This commit is contained in:
parent
b226a4df9d
commit
aaa41624aa
|
@ -110,6 +110,7 @@ export const fetchRequest = (config: IrRequestConfig): Promise<IrResponse> => {
|
||||||
headers: headersObj,
|
headers: headersObj,
|
||||||
config,
|
config,
|
||||||
request: null,
|
request: null,
|
||||||
|
responseURL: response.url
|
||||||
};
|
};
|
||||||
|
|
||||||
const responseBody = onDownloadProgress
|
const responseBody = onDownloadProgress
|
||||||
|
|
|
@ -98,6 +98,7 @@ export const ieFetchRequest = (config: IrRequestConfig): Promise<IrResponse> =>
|
||||||
headers: response.headers,
|
headers: response.headers,
|
||||||
config,
|
config,
|
||||||
request: null,
|
request: null,
|
||||||
|
responseURL: response.url
|
||||||
};
|
};
|
||||||
|
|
||||||
// 根据 responseType 选择相应的解析方法
|
// 根据 responseType 选择相应的解析方法
|
||||||
|
|
|
@ -74,7 +74,8 @@ function processUploadProgress(
|
||||||
statusText: xhr.statusText,
|
statusText: xhr.statusText,
|
||||||
headers: xhr.getAllResponseHeaders(),
|
headers: xhr.getAllResponseHeaders(),
|
||||||
config: config,
|
config: config,
|
||||||
}
|
request: xhr
|
||||||
|
};
|
||||||
|
|
||||||
if (config.validateStatus!(xhr.status)) {
|
if (config.validateStatus!(xhr.status)) {
|
||||||
// 如果 fetch 请求已经成功或者拒绝,则此处不生效
|
// 如果 fetch 请求已经成功或者拒绝,则此处不生效
|
||||||
|
|
|
@ -95,6 +95,9 @@ export type IrResponse<T = any> = {
|
||||||
|
|
||||||
// 响应事件消息
|
// 响应事件消息
|
||||||
event?: string;
|
event?: string;
|
||||||
|
|
||||||
|
// 响应对象上的完整 URL
|
||||||
|
responseURL?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Ir 类接口类型
|
// Ir 类接口类型
|
||||||
|
|
Loading…
Reference in New Issue