EventSource / eventsource

EventSource client for Node.js and Browser (polyfill)
MIT License
898 stars 251 forks source link

bug: eventsource fails to reject self-signed certs if non-empty options are provided #322

Open evanshortiss opened 1 year ago

evanshortiss commented 1 year ago

I stumbled across this issue when I tried to understand why NODE_TLS_REJECT_UNAUTHORIZED didn't work with this library.

The following code will work as expected, and reject a self-signed TLS certificate.

const es = new EventSource('https://self-signed.com')

However, the following code will connect to the self-signed certificate:

const es = new EventSource('https://self-signed.com', {})

This appears to be an unexpected, and undesirable behaviour. Let me know if I've misunderstood. I'll open a PR in the meantime :)