Skip to content

Commit

Permalink
docs: uni.request 增加参数 sslVerify 说明
Browse files Browse the repository at this point in the history
  • Loading branch information
zhetengbiji committed Sep 23, 2019
1 parent b9d0918 commit 7b83636
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docs/api/request/request.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
|method|String||GET|有效值详见下方说明||
|dataType|String||json |如果设为 json,会尝试对返回的数据做一次 JSON.parse||
|responseType|String||text |设置响应的数据类型。合法值:text、arraybuffer|5+App和支付宝小程序不支持|
|sslVerify|Boolean||true|验证 ssl 证书|仅5+App安卓端支持(HBuilderX 2.3.4+)|
|success|Function|||收到开发者服务成功返回的回调函数||
|fail|Function|||接口调用失败的回调函数||
|complete|Function|||接口调用结束的回调函数(调用成功、失败都会执行)| |
Expand Down Expand Up @@ -122,5 +123,6 @@ requestTask.abort();
- debug 模式,安卓端暂时无法获取响应头,url中含有非法字符(如未编码为%20的空格)时会请求失败
- iOS App第一次安装启动后,会弹出是否允许联网的询问框,在用户点击同意前,调用联网API会失败。请注意判断这种情况。比如官方提供的新闻模板示例(HBuilderX新建项目可选择),会判断如果无法联网,则提供一个错误页,提示用户设置网络及下拉刷新重试。
- 良好体验的App,还会判断当前是否处于飞行模式([参考](https://ext.dcloud.net.cn/plugin?id=594))、是wifi还是3G([参考](https://uniapp.dcloud.io/api/system/network)
- 部分Android设备,真机运行或debug模式下的网络,低于release模式很多。
- 部分安卓设备,真机运行或debug模式下的网络,低于release模式很多。
- 安卓端请求某些 https 服务会失败,可以尝试配置 sslVerify 为 false 关闭 ssl 证书验证
- 单次网络请求数据量建议控制在50K以下(仅指json数据,不含图片),过多数据应分页获取,以提升应用体验。

0 comments on commit 7b83636

Please sign in to comment.