question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

XMLHttpRequest is discouraged

See original GitHub issue

XMLHttpRequest is discouraged and will be more rare to be found in the new contexts like service worker.

Should axios use fetch when XMLHttpRequest is not available?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:30
  • Comments:15 (2 by maintainers)

github_iconTop GitHub Comments

17reactions
Blfrgcommented, Jul 25, 2018

Please revisit this concept to implement a fetch adapter.

I see some community work has been done here which could jump start the process. @jamesplease’s work above on fetch polyfill has been merged if that helps squelch outstanding concerns.

Axios is the suggested library everywhere you look (and for good reason!) fetch is needed for PWA+SW which is all the rage now. A compromise is highly desired by all, even if it’s a choice between features (e.g. ability to cancel vs support offline SW).

Thank you for the essential module and consideration for the feature request.

3reactions
botversecommented, Oct 21, 2016

@adzm I would be happy to be able to use axios in the service worker knowing that I would not be able to cancel rather than not to be able to use it at all. So in that case is not very versatile.

One advantage of using axios in the service worker is to reuse the client code instead of duplicating the flow for all the requests.

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTML in XMLHttpRequest - Web APIs | MDN
Chrome Edge XMLHttpRequest Full support. Chrome1. Toggle history Full support. Edge12... XMLHttpRequest() constructor Full support. Chrome1. Toggle history Full support. Edge12... abort Full support. Chrome1. Toggle...
Read more >
CORs does not get enabled when using XMLHttpRequest?
Attempting to make CORS request 'withCredentials' exist in xhr Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote ...
Read more >
XMLHttpRequest - W3C
Extensions of the API defined by this specification are strongly discouraged. User agents, Working Groups and other interested parties ...
Read more >
Source/core/xml/XMLHttpRequest.cpp - chromium/blink.git
// attempt to discourage synchronous XHR use. responseType is one such piece of functionality. // We'll only disable this functionality for HTTP(S) requests ......
Read more >
Prototype v1.7.3 API documentation | Ajax section
asynchronous (Boolean; default true ): Determines whether XMLHttpRequest is used asynchronously or not. Synchronous usage is strongly discouraged — it halts ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found