Axios响应错误:证书已过期

我正在使用axios将请求发送到diro,以创建一个端点为/user/create的用户。

但是,我不断收到这样的错误:

Error response: { Error: certificate has expired
    at TLSSocket.onConnectSecure (_tls_wrap.js:1055:34)
    at TLSSocket.emit (events.js:198:13)
    at TLSSocket.EventEmitter.emit (domain.js:448:20)
    at TLSSocket._finishInit (_tls_wrap.js:633:8)

这是我的要求:

const DIRO_API_KEY = ******
createUserToDiro = ({
  phone,first_name,last_name,birth_date,mcc_code
}) => {
  const mobile = phone;
  const firstname = first_name;
  const lastname = last_name;
  const dob = formatDiroDob(birth_date);
  const mcc = mcc_code;
  axios.post('https://api.dirolabs.com/user/create'),{
    firstname,lastname,dob,mobile,mcc,apikey: DIRO_API_KEY
  })
  .then(rs => console.log('Success response:',rs))
  .catch(err => console.log('Error response:',err));

};

是什么原因导致此问题,有什么方法可以解决?

hhyyoo 回答:Axios响应错误:证书已过期

Axios库错误明确提到证书已过期。

请要求diro续订SSL证书。

另一种我们可以跳过Axios npm库中的SSL的检查方法,如下所示:

2020-06-05 info: header line 
2020-06-05|columnAValue|columnBValue|
2020-06-05|columnAValue||columnCValue
2020-06-05|columnAValue|columnBValue|columnCValue

这有效。

本文链接:https://www.f2er.com/3154553.html

大家都在问