NodeJS HTTPS API testing with mocha and super test -“DEPTH_ZERO_SELF_SIGNED_CERT”

前端 未结 1 1769
囚心锁ツ
囚心锁ツ 2020-12-31 09:00

I need to test an API served via HTTPS with mocha and super test (the certificate are not expired)

This is a gist of the serve

1条回答
  •  长情又很酷
    2020-12-31 09:36

    just for everyone else who is also wondering what to do. Add thison top of your test.js and you will be fine:

    process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
    

    0 讨论(0)
提交回复
热议问题