mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-25 06:29:20 +08:00
feat: 模型管理独立页与会话级选模型
This commit is contained in:
@@ -41,6 +41,14 @@ describe('requestClient', () => {
|
||||
expect(response.data).toEqual(mockData);
|
||||
});
|
||||
|
||||
it('should successfully make a PATCH request', async () => {
|
||||
const patchData = { key: 'patchedValue' };
|
||||
const mockData = { data: 'patched response' };
|
||||
mock.onPatch('/test/patch', patchData).reply(200, mockData);
|
||||
const response = await requestClient.patch('/test/patch', patchData);
|
||||
expect(response.data).toEqual(mockData);
|
||||
});
|
||||
|
||||
it('should successfully make a DELETE request', async () => {
|
||||
const mockData = { data: 'delete response' };
|
||||
mock.onDelete('/test/delete').reply(200, mockData);
|
||||
@@ -94,6 +102,6 @@ describe('requestClient', () => {
|
||||
|
||||
const res = await requestClient.download('/test/download');
|
||||
|
||||
expect(res.data).toBeInstanceOf(Blob);
|
||||
expect(res).toBeInstanceOf(Blob);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -125,6 +125,17 @@ class RequestClient {
|
||||
return this.request<T>(url, { ...config, data, method: 'PUT' });
|
||||
}
|
||||
|
||||
/**
|
||||
* PATCH请求方法
|
||||
*/
|
||||
public patch<T = any>(
|
||||
url: string,
|
||||
data?: any,
|
||||
config?: RequestClientConfig,
|
||||
): Promise<T> {
|
||||
return this.request<T>(url, { ...config, data, method: 'PATCH' });
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用的请求方法
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user