Axios-module: response.body undefined

Created on 1 Jan 2018  路  4Comments  路  Source: nuxt-community/axios-module

I'm hitting my own endpoint which returns res.status(500).json({ message: 'Server Error' }). i can see the correct response in Chrome devtools network tab. however, on my app i get Error: Request failed with status code 500

return this.$axios.$get('/...')
  .then(res => {
    console.log(res)
  })
  .catch(err => {
    console.log(err)
  })

its the same for all error codes. the only way i can receive a json is with status 200.

am i missing something here? any help would be appreciated!

This question is available on Nuxt.js community (#c62)

Most helpful comment

Try to get the response

...
.catch(err => {
   console.log(err.response)
})

All 4 comments

same - I think this stems from axios itself being broken in the latest version: https://github.com/axios/axios/issues/1085

Try to get the response

...
.catch(err => {
   console.log(err.response)
})

@anteriovieira that works for me! could have sworn i tried it though

Closing as this seems not directly related to this repo.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

monty086 picture monty086  路  3Comments

simllll picture simllll  路  6Comments

kaboume picture kaboume  路  4Comments

megapctr picture megapctr  路  5Comments

gammpamm picture gammpamm  路  4Comments