ty.request
获取网络请求任务对象 RequestTask
参数
Object object
发起 HTTPS 网络请求的回调函数
回调参数 Object res
属性 | 类型 | 默认值 | 必填 | 说明 |
---|---|---|---|---|
url | string |
是 | 开发者服务器接口地址 | |
data | string |
否 | 请求的参数 | |
header | any |
否 | 设置请求的 header,header 中不能设置 Referer。 | |
timeout | number |
否 | 超时时间,单位为毫秒 | |
method | HTTPMethod |
否 | HTTP 请求方法 | |
complete | function |
否 | 接口调用结束的回调函数(调用成功、失败都会执行) | |
success | function |
否 | 接口调用成功的回调函数 | |
fail | function |
否 |
object.success 回调参数
参数
Object res
属性 | 类型 | 说明 |
---|---|---|
data | string |
开发者服务器返回的数据 |
statusCode | number |
开发者服务器返回的 HTTP 状态码 |
header | any |
开发者服务器返回的 HTTP Response Header |
cookies | array |
开发者服务器返回的 cookies,格式为字符串数组 |
profile | Profile |
网络请求过程中一些调试信息 |
taskId | string |
网络请求 id,用户取消、监听等操作 |
object.fail 回调参数
参数