Migration Guides

How to migrate from Axios module

This guide will help you to migrate from Axios Module.

The nuxt-community axios module is still supported and maintained. The HTTP module uses newer web technologies like fetch which might be beneficial


When calling these methods they apply to the global scope and are used for all future requests

  • The axios hooks onRequestError and onResponseError are unified

Use the onError hook instead

  • The http module does not have a debug option like the axios module

You can setup a basic logger using the onRequest hook

  • Progress bar integration is not supported (for the moment)

This option may be added again once PR #105 : progress bar is merged

Response body parsing

Axios automatically transforms response bodies to JSON, if you wish to keep that behaviour you will

  • either need to switch to using the $ prefixed methods

-- const resJson = await this.$axios.get('/url')
++ const resJson = await this.$http.$get('/url')
  • or explicitly call json on the Response:

-- const resJson = await this.$axios.get('/url')
++ const resJson = await this.$http.get('/url').json()

If you are already using $ prefixed shortcuts for making requests that return JSON, you can keep using them.

-- const resJson = await this.$axios.$get('/url')
++ const resJson = await this.$http.$get('/url')