跳转到主要内容通用 HTTP 客户端,适用于 Node.js 和浏览器环境
• new HttpClient(): HttpClient
HttpClient
定义于
http-client.ts:41
▸ createHeaders(init?): Headers
创建新的 Headers 实例
| 名称 | 类型 | |
|---|
init? | Record<string, string> | Headers |
Headers
定义于
http-client.ts:91
▸ request(url, options?): Promise<HttpResponse>
发起 HTTP 请求
Promise<HttpResponse>
定义于
http-client.ts:98
▸ get(url, headers?): Promise<HttpResponse>
发起 GET 请求
| 名称 | 类型 |
|---|
url | string |
headers? | Record<string, string> |
Promise<HttpResponse>
定义于
http-client.ts:135
▸ post(url, body?, headers?): Promise<HttpResponse>
发起 POST 请求
| 名称 | 类型 |
|---|
url | string |
body? | string |
headers? | Record<string, string> |
Promise<HttpResponse>
定义于
http-client.ts:148
▸ put(url, body?, headers?): Promise<HttpResponse>
发起一个 PUT 请求
| 参数名 | 类型 |
|---|
url | string |
body? | string |
headers? | Record<string, string> |
Promise<HttpResponse>
定义于
http-client.ts:163
▸ delete(url, headers?): Promise<HttpResponse>
发送 DELETE 请求
| 名称 | 类型 |
|---|
url | string |
headers? | Record<string, string> |
Promise<HttpResponse>
http-client.ts:178
▸ patch(url, body?, headers?): Promise<HttpResponse>
发起 PATCH 请求
| 参数名 | 类型 |
|---|
url | string |
body? | string |
headers? | Record<string, string> |
Promise<HttpResponse>
定义于
http-client.ts:191