Skip to content

Commit

Permalink
Only parse url if it's a string
Browse files Browse the repository at this point in the history
  • Loading branch information
rumpl committed Apr 8, 2021
1 parent 5ef0dc9 commit 525b42e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/eventsource.js
Expand Up @@ -81,7 +81,10 @@ function EventSource (url, eventSourceInitDict) {
var reconnectUrl = null

function connect () {
var options = parse(url)
var options = url
if (typeof url === 'string') {
options = parse(url)
}
var isSecure = options.protocol === 'https:'
options.headers = { 'Cache-Control': 'no-cache', 'Accept': 'text/event-stream' }
if (lastEventId) options.headers['Last-Event-ID'] = lastEventId
Expand Down

0 comments on commit 525b42e

Please sign in to comment.