Skip to content

XMLHttpRequest polyfill doesn't provide the withCredentials property #5347

@navels

Description

@navels

The real problem I'm having is that socket.io-client is unable to connect via the polling transport when running the chrome debugger. This is because it's a cross-domain request (debugger port is 8081 whereas my local server is running on port 3000) and socket.io in that case will only use XMLHttpRequest if it supports CORS.

socket.io-client checks for CORS like this:

module.exports = typeof XMLHttpRequest !== 'undefined' &&
  'withCredentials' in new XMLHttpRequest();

which fails and ultimately it has to fall back on WS. That isn't so terrible but made for some very confusing debugging. I'd prefer for the behavior while debugging to be as close as possible to running the real app.

Am happy to submit a PR if this makes sense. (FYI this is on react-native 0.18.0-rc)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions