我有以下代码,它是从快速服务器运行的:
import fetch from 'node-fetch';
let formBody = [];
const dataLogin = {
'username': 'myUser',
'password': 'myPassword'
};
for (let p in dataLogin) {
let encodedKey = encodeURIComponent(p);
let encodedValue = encodeURIComponent(dataLogin[p]);
formBody.push(encodedKey + "=" + encodedValue);
}
formBody = formBody.join("&");
const url = 'https://external-login-api.com';
return fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': formBody.length
},
body: formBody
});
当我运行代码时,我收到以下错误,尽管能够在 Postman 中运行请求而没有问题。
{"message":"对https://external-login-api.com的请求失败,原因:写入 EPROTO 7316:error:141A318A:SSL 例程:tls_process_ske_dhe:dh 密钥太小:openssl\ssl\statem\statem_clnt.c :1472:\n","type":"system","errno":"EPROTO","code":"EPROTO"}
如何为此请求禁用 SSL 验证?