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

In browsers check for XMLHttpRequest, not window #85

Merged
merged 2 commits into from Jul 23, 2015

Conversation

@tomaash
Copy link
Contributor

commented Jul 13, 2015

In nodejs testing environment it's possible to use https://github.com/tmpvar/jsdom library to define a window object, but you still want to use node http adapter. Due to those diverse testing environmnents, I propose to test for XMLHttpRequest directly, because window global object is not a sure sign of a browser environment anymore.

In browsers check for XMLHttpRequest, not window
In nodejs testing environment it's possible to use https://github.com/tmpvar/jsdom library to define a window object, but you still want to use node http adapter. Due to those diverse testing environmnents, I propose to test for XMLHttpRequest directly, because window global object is not a sure sign of a browser environment anymore.
@mzabriskie

This comment has been minimized.

Copy link
Member

commented Jul 23, 2015

Thanks for the PR. Unfortunately XMLHttpRequest doesn't exist in older versions of IE. Can you provide a solution that works for IE8?

XHR browser check now works in IE8
Test for ActiveXObject
@tomaash

This comment has been minimized.

Copy link
Contributor Author

commented Jul 23, 2015

Damn, I always forget about those IE specialities. I added check for ActiveXObject, so now it should work in IE8 as well.

@mzabriskie

This comment has been minimized.

Copy link
Member

commented Jul 23, 2015

Looks good. Thank you!

@mzabriskie mzabriskie closed this Jul 23, 2015

@mzabriskie mzabriskie reopened this Jul 23, 2015

mzabriskie added a commit that referenced this pull request Jul 23, 2015

Merge pull request #85 from tomaash/patch-1
In browsers check for XMLHttpRequest, not window

@mzabriskie mzabriskie merged commit 63ac064 into axios:master Jul 23, 2015

0 of 2 checks passed

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
coverage/coveralls Coverage pending from Coveralls.io
Details
@tomaash

This comment has been minimized.

Copy link
Contributor Author

commented Jul 23, 2015

Thanks for merging this. Can you please also bump patch version?

@mzabriskie

This comment has been minimized.

Copy link
Member

commented Jul 23, 2015

I'm working on getting a new release out soon.

@mzabriskie

This comment has been minimized.

Copy link
Member

commented Sep 21, 2015

@tomaash I just released 0.6.0 which includes your PR.

@tomaash

This comment has been minimized.

Copy link
Contributor Author

commented Sep 22, 2015

Cool, thanks!

On Tue, Sep 22, 2015 at 12:58 AM, Matt Zabriskie notifications@github.com
wrote:

@tomaash https://github.com/tomaash I just released 0.6.0 which
includes your PR.


Reply to this email directly or view it on GitHub
#85 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.