Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix socket behaviour #455

Open
Tracked by #2517
mikicho opened this issue Sep 28, 2023 · 0 comments
Open
Tracked by #2517

Fix socket behaviour #455

mikicho opened this issue Sep 28, 2023 · 0 comments

Comments

@mikicho
Copy link
Contributor

mikicho commented Sep 28, 2023

I unified this in one issue because we need to take all of these into account in the solution.

  1. Socket authorized and encrypted are false for https requests
https.get('https://example.test').on('socket', socket => {
    expect(socket.authorized).to.equal(true) // always false, test fails
    expect(socket.encrypted).to.equal(true) // always false, test fails
    done()
  })
  1. never emit (socket) connect event for an invalid URL (e.g. example.test) because Node tries to connect to the URL, and we capture the ENOTFOUND.
  2. We can't use socket.setTimeout for invalid URL (e.g. example.test`) because it emits error
@mikicho mikicho changed the title Set socket authorized and encrypted to true for https requests Socket authorized and encrypted are false for https requests Sep 28, 2023
@mikicho mikicho changed the title Socket authorized and encrypted are false for https requests Fix socket behaviour Sep 29, 2023
@kettanaito kettanaito added this to the Nock compatibility milestone Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants