mirror of
https://github.com/labring/FastGPT.git
synced 2025-10-14 15:11:13 +00:00
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:
@@ -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
|
||||
};
|
||||
|
Reference in New Issue
Block a user