aragon / apm.js

JavaScript library for the Aragon Package Manager
GNU Lesser General Public License v3.0
16 stars 9 forks source link

Move from “got” to axios #21

Closed bpierre closed 6 years ago

bpierre commented 6 years ago

When used in the browser, got sets two headers in its requests, without a possibility to remove them:

  Access-Control-Request-Method: GET
  Access-Control-Request-Headers: user-agent

These headers were making requests fail on Firefox, on servers that do not set "user-agent" explicitly in the allowed CORS headers (specifically gateway.ipfs.io).

Another reason for the move is that got is using several Node.js modules that are expected to be polyfilled by the bundler, which can result in an excessively large bundle size (169.113K with got, 16.103K with axios).

API change: the getFileStream() method now returns a promise that resolves to a stream, rather than a stream directly.