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.

missing HTTP adapter?

See original GitHub issue

Axios v0.14.0 Node v6.6.0

I’m trying to do a simple GET, and I’m faced with ReferenceError: XMLHttpRequest is not defined. I was looking through the code in dist/axios.js, and I’m seeing something unexpected:

if (typeof config.adapter === 'function') {
  // For custom adapter support
  adapter = config.adapter;
} else if (typeof XMLHttpRequest !== 'undefined') {
  // For browsers use XHR adapter
  adapter = __webpack_require__(10);
} else if (typeof process !== 'undefined') {
  // For node use HTTP adapter
  adapter = __webpack_require__(10);
}

Webpack seems to be requiring the same dependency for both XHR and HTTP adapters, __webpack_require__(10). Further, when I search for httpAdapter and dispatchHttpRequest, nothing comes up.

Is the v0.14.0 release missing the HTTP adapter?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

11reactions
UnsungHero97commented, Oct 6, 2016

@nickuraltsev Got it. Any suggestions on how to build axios with both adapters included, with the goal being to bundle a single library that can run both on the web and in node?

9reactions
Naramsimcommented, Mar 9, 2017

Using the target: 'node' with the entry node: { process: false }, and a plugin

plugins: [
    new webpack.DefinePlugin({
      'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
    })
  ]

Makes the output library both working on the web and node.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Receiver HTTP-adapter, Content Server, missing payload
Hi Experts! We have a scenario where we transform a xml-file into html-message, and try to post it to a SAP content server,...
Read more >
HTTP Adapter :: Eclipse Hono™
The HTTP protocol adapter exposes HTTP based endpoints for Eclipse Hono™'s south bound Telemetry, Event and Command & Control APIs.
Read more >
HTTP Server Adapter (V5.2.6 or later) - IBM
The HTTP Server adapter processes HTTP requests from trading partners by using a perimeter server. ... No – HTTP basic authentication is not...
Read more >
HTTP adapter - FAQ | NestJS - A progressive Node.js framework
HTTP adapter. Occasionally, you may want to access the underlying HTTP server, either within the Nest application context or from the outside.
Read more >
Python Requests - No connection adapters - Stack Overflow
You need to include the protocol scheme: 'http://192.168.1.61:8080/api/call'. Without the http:// part, requests has no idea how to connect to the remote ...
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