question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TLSSocket supported?

See original GitHub issue

I’m trying to test this GOT http client. https://github.com/sindresorhus/got

They use a library that checks the socket is a TLSSocket. socket instanceof TLSSocket

https://github.com/szmarczak/defer-to-connect/blob/41786a90bbcb2c3530d99b62b2c23b295274e761/source/index.ts#L29

Is there a way to get Nock to use a TLSSocket instead of a Socket? I tried using “https://” protocol, but the Socket seen by the Got Client is not a TLSSocket

const mockReq = nock("https://localhost") .get("/test") .reply(200, { measure: "true" });

The Got client has timings for tls connection, but my test is not getting the tls timing due to Socket not being a TLSSocket.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
datvong-wmcommented, Feb 25, 2021

Yes! This works great! Thank you all for the quick turn-around!

2reactions
szmarczakcommented, Feb 24, 2021

Released 2.0.1, do let me know if that works out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TLS (SSL) | Node.js v19.3.0 Documentation
SNI: Allows the use of one TLS server for multiple hostnames with different certificates. Pre-shared keys#. TLS-PSK support is available as an alternative...
Read more >
TLSSocket - API references and tutorials - Mbed
To use secure TLS connections, the application uses the TLSSocketWrapper through the Socket API, so existing applications and libraries are compatible.
Read more >
ssl — TLS/SSL wrapper for socket objects — Python 3.11.1 ...
It supports additional methods such as getpeercert() , which retrieves the certificate of the other side of the connection, and cipher() , which...
Read more >
Tls - node - Read the Docs
Node.js is compiled with SSLv2 and SSLv3 protocol support by default, but these protocols are ... TLSSocket instance when the threshold is exceeded....
Read more >
"tls" | typescript - v3.7.7
It can be assigned any of the supported TLS protocol versions, 'TLSv1.3', 'TLSv1.2', ... secureConnectListener?: function): TLSSocket; connect(port: number, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found