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

Proxy using fetch under the hood? #78

Open
tom-drake opened this issue Feb 1, 2019 · 2 comments
Open

Proxy using fetch under the hood? #78

tom-drake opened this issue Feb 1, 2019 · 2 comments
Milestone

Comments

@tom-drake
Copy link

I noticed that if a request is proxied it is done as a fetch rather than an XHR. Would it make sense just to use the RealXMLHttpRequest rather than 'http' and 'https'?

@jameslnewell jameslnewell added this to the v3 milestone Feb 19, 2019
@jameslnewell
Copy link
Owner

Yep sounds reasonable. From memory, because we've replaced the global XMLHttpRequest, we don't have access to the real XMLHttpRequest within a handler so using fetch was a hack to send real requests instead of mock ones.

In v3 the handler will receive a context object that we can put the real XMLHttpRequest on.

@tom-drake
Copy link
Author

If this is going into a future version then great. I worked around this by creating my own proxy that makes use of XHRMock.RealXMLHttpRequest which seems to give me access to the real one before being overridden.

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

No branches or pull requests

2 participants