Skip to content

fix close function to abort XHR - #52

Merged
aslakhellesoy merged 1 commit into
EventSource:masterfrom
brian-medendorp:master
Feb 24, 2016
Merged

fix close function to abort XHR#52
aslakhellesoy merged 1 commit into
EventSource:masterfrom
brian-medendorp:master

Conversation

@brian-medendorp

Copy link
Copy Markdown

I noticed while using the polyfill, calling the close() function was not actually closing the http connection, but making this small change to call the abort() function of the actual xhr reference fixed the problem.

@brian-medendorp

Copy link
Copy Markdown
Author

I did attempt to write tests for this, but I couldn't find any existing tests of the close function, except for an assertion of the readyState after close() is called. There's no external reference to "req" or "xhr", so writing a test would likely involve mocking the entire http/https dependency, which seems a bit excessive for one line of code.

@aslakhellesoy
aslakhellesoy merged commit fe88db8 into EventSource:master Feb 24, 2016
@aslakhellesoy

Copy link
Copy Markdown
Contributor

Thanks!

Yeah, it's harder to write tests for the polyfill - would be nice to have some automated tests running in an actual browser.

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

Successfully merging this pull request may close these issues.

2 participants