Add unit tests for request utility functions in the API module. (#5254)

Co-authored-by: gru-agent[bot] <185149714+gru-agent[bot]@users.noreply.github.com>
This commit is contained in:
gru-agent[bot]
2025-07-21 13:30:10 +08:00
committed by GitHub
parent ab69b317a0
commit cfefe69a96
2 changed files with 149 additions and 1 deletions

View File

@@ -35,7 +35,7 @@ const maxQuantityMap: Record<
}[]
> = {};
/*
/*
Every request generates a unique sign
If the number of requests exceeds maxQuantity, cancel the earliest request and initiate a new request
*/
@@ -112,6 +112,7 @@ function responseError(err: any) {
const isOutlinkPage = {
'/chat/share': true,
'/chat/team': true,
'/chat': true,
'/login': true
}[window.location.pathname];
@@ -223,3 +224,15 @@ export function PUT<T = undefined>(url: string, data = {}, config: ConfigType =
export function DELETE<T = undefined>(url: string, data = {}, config: ConfigType = {}): Promise<T> {
return request(url, data, config, 'DELETE');
}
export {
maxQuantityMap,
checkMaxQuantity,
requestFinish,
startInterceptors,
responseSuccess,
checkRes,
responseError,
instance,
request
};