文件最后提交记录最后更新时间
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
README.md

ClientRequest API 列表

本模块包含 17 个 API。

Events(事件)

API 说明 鸿蒙支持
response 收到 HTTP 响应时触发。 支持
login 在需要身份验证的代理要求提供用户凭据时触发。 支持
finish 在请求数据的最后一个块写入请求对象后立即触发。 支持
abort 在请求被中止时触发,若请求已关闭则不会触发此事件。 支持
error 当 net 模块发起网络请求失败时触发,通常随后会触发 close 事件且不会返回响应对象。 支持
close 作为 HTTP 请求-响应事务中的最后一个事件触发,表示请求和响应对象上不会再触发任何事件。 支持
redirect 在服务器返回重定向响应(如 301 Moved Permanently)时触发。 支持

Methods(方法)

API 说明 鸿蒙支持
new ClientRequest(options) 请求的 URL,若为对象,则需通过以下属性完整指定 HTTP 请求:method。 支持
request.setHeader(name, value) 添加额外的 HTTP 请求头,头部名称将按原样发送,不会转换为小写。 支持
request.getHeader(name) 返回 string,即之前设置的指定额外请求头的值。 支持
request.removeHeader(name) 移除之前设置的指定额外请求头,此方法只能在首次写入数据之前调用。 支持
request.write(chunk[, encoding][, callback]) 若 chunk 为 string,则使用指定的 encoding 将其转换为 Buffer 后写入请 支持
request.end([chunk][, encoding][, callback]) 返回 this,结束请求发送。 支持
request.abort() 取消正在进行的 HTTP 事务,若请求已触发 close 事件则此操作无效。 支持
request.followRedirect() 继续执行待处理的重定向,只能在 'redirect' 事件中调用。 支持
request.getUploadProgress() 返回 Object,包含上传进度信息。 支持

Properties(属性)

API 说明 鸿蒙支持
request.chunkedEncoding 布尔值,指定请求是否使用 HTTP 分块传输编码,默认为 false。 支持