Only parse url if it's a string
With this change we can use eventsource even when calling a server over a unix domain socket, for example:
const es = new EventSource({
socketPath: 'some-socket.sock',
path: '/my-path',
});
...
The failure on node 4.x seems unrelated to my change
SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/home/runner/work/eventsource/eventsource/node_modules/standard/node_modules/standard-engine/node_modules/deglob/index.js:8:16)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
npm ERR! Test failed. See above for more details.
Error: Process completed with exit code 1.
This simple PR is very helpful to have Unix Domain Socket support. Could anyone have an eye on it please?
The force push is just a rebase with master
ping @rexxars PTAL; looks like we're currently maintaining a fork because of this ~fix~ enhancement missing in the upstream repository 😓 would be great to see this merged so that we can get rid of the fork.
@rumpl could you do a rebase to trigger CI?