angular - JS: Https.request 错误 ReferenceError: okhttp3 is not defined
问题描述
我按照这个https://github.com/gethuman/nativescript-https
安装:tns plugin add nativescript-https
编写以下代码:
public output() {
Https.request({
url: 'https://xxx.xxx.x.x/output?pass=1&out1=1',
method: 'GET',
headers: {
'Authorization': 'Basic ZWx1c3VhcmlvOnlsYWNsYXZl',
'x-uuid': 'aHR0cHdhdGNoOmY',
'x-version': '4.2.0',
'x-env': 'DEVELOPMENT',
},
}).then(function(response) {
console.log('Https.request response', response)
}).catch(function(error) {
console.error('Https.request error', error)
})
}
命令:tns run
显示这个:
JS: nativescript-https > Disabled SSL pinning by default
JS: Angular is running in the development mode. Call enableProdMode() to enable the production mode.
JS: Https.request error ReferenceError: okhttp3 is not defined
解决方案
推荐阅读
- html - MIME 类型('text/css')不可执行,并且启用了严格的 MINE 类型检查
- angular - Angular6参数表达式预期错误
- python - 只要有可用资源,就并行运行 Spark 代码,而不是按顺序运行
- php - PHP 测试 JSON 包含 SQLite
- css - CSS 中的 .dygraph-legend 类不会改变我的 Dygraph 图例
- java - 套件类别中的特定测试
- vb.net - SQL 出现在已编译的 DLL 文件中
- vue.js - 如何在 VueJS 项目中构建 Vuex 模块?
- python - 在熊猫的循环中调用局部变量
- reactjs - React Flow ESlint:解析错误意外令牌,预期','