node.js - 如何使用 nodejs 创建 https REST 客户端?
问题描述
我正在尝试使用node-rest-client从 https 端点获取数据
const Client = require('node-rest-client').Client;
const client = new Client();
client.get("https://myapi.com/data.xml", function (data, response) {
// parsed response body as js object
console.log(data);
// raw response
console.log(response);
});
但我收到了这个错误:
Error: unable to verify the first certificate
at TLSSocket.onConnectSecure (_tls_wrap.js:1049:34)
at TLSSocket.emit (events.js:182:13)
at TLSSocket._finishInit (_tls_wrap.js:631:8)
解决方案
推荐阅读
- kotlin - 改变一些数据的某个属性的值,但是tableview没有更新
- python - 试图找到一种方法来删除或显示与 python 的类似引用
- node.js - 根据键值从 Redis 查询
- shell - 如何在正常运行时间后 1 小时终止 ec2 实例
- javascript - 使用 Laravel 时如何将参数传递给 jQuery 函数
- php - 如何在 Laravel 中修复意外的 '->' (T_OBJECT_OPERATOR)"?
- postgresql - 通过在 postgresql 上声明变量来选择查询
- android - 按下按钮时在 TextView 上显示 LatLng
- asp.net - Angular js:使用 ng-class 过滤数据
- three.js - 为什么在导出为 GLTF 时,blender rigged 动画会变形?