-
-
Notifications
You must be signed in to change notification settings - Fork 771
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
ReactNative compatibility. Allow sinon fakeServer to run in React Native #1052
Conversation
…ve environment either on device or browser debug. ReactNative has xhr support via polyfill. But the check for supporting xhr looked and withEntitlements which is failing in RN. ReactNative does not have window.location so a default assignment and check for undefined window.location was needed.
@@ -33,6 +33,7 @@ function responseArray(handler) { | |||
} | |||
|
|||
var wloc = typeof window !== "undefined" ? window.location : {}; | |||
wloc = typeof wloc !== "undefined" ? wloc : { "host" : "localhost", "protocol" : "http"}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 35 and 36 could be squashed into one line. You are guaranteed that
wloc is defined.
var wloc = typeof window !== "undefined" ? window.location : { "host" : "localhost", "protocol" : "http"};
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will do that tomorrow.
I think this is fine, but could you just compress the two lines mentioned? I am also going to squash these commits into one, unless you do it yourself, as a final step. |
Change is done. Please squash. |
Purpose (TL;DR) - mandatory
Background (Problem in detail) - optional
Solution - optional
How to verify - mandatory