Skip to content
This repository was archived by the owner on Nov 12, 2025. It is now read-only.

Commit 4ed60e2

Browse files
committed
feat(request): 添加 PUT 请求方法
- 在 Request 类中增加了 put 方法,支持发送 PUT 请求 - 扩展了 request 方法的参数类型,支持 'put' 操作
1 parent a32eb28 commit 4ed60e2

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/models/base/request.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export class Request {
4444
* @returns 响应结果
4545
*/
4646
private async request (
47-
method: 'get' | 'post',
47+
method: 'get' | 'post' | 'put',
4848
path: string,
4949
data?: any,
5050
params?: any,
@@ -120,6 +120,17 @@ export class Request {
120120
return this.request('post', path, data, undefined, customHeaders)
121121
}
122122

123+
/**
124+
* 发送PUT请求
125+
* @param path
126+
* @param data
127+
* @param customHeaders
128+
* @returns 响应结果
129+
*/
130+
async put (path: string, data?: any, customHeaders?: Record<string, string>): Promise<ResponseType> {
131+
return this.request('put', path, data, undefined, customHeaders)
132+
}
133+
123134
/**
124135
* 创建请求头
125136
* @param customHeaders - 自定义请求头

0 commit comments

Comments
 (0)