I’ve been poking around the different HTTP agents, and I think axios is my favourite compared to request or superagent.

  1. Most importantly, axios provides its own type definitions for TypeScript. That’s just super nice. Request and superagent both have types in DefinitelyTyped, but they’re out of date because they aren’t maintained with the project.
  2. axios has a very nice concept of Interceptors which allow the request to be modified or inspected before it is sent. In my particular case, I wanted to inspect the body of the request and axios offered a nice public API for me to do that.
  3. axios supports import … from syntax; the others do not.
  4. Request bundles form-data which seems nice at first glance, but actually ends up being unpleasant. With Request, the bundled version is out of date and is missing both TypeScript type definitions and a handy new getBuffer() function. It’s better to just import form-data yourself, if needed, and pass the prepared object to the HTTP agent (as a stream, Buffer, or FormData as desired). These concerns are easily separated.
  5. Request doesn’t use a promises interface by default (the others do) and that requires importing one of three promise wrappers. (edited)