[Vuejs]-Post to given endpoint as multipart file

0👍

The second argument to post should be the actual FormData, fd in your case.

axios.post('/saveavatar',
              fd,
              {headers: {'Authorization': 'Bearer ' + localStorage.getItem('access_token')}})

The reason it works in Insomia is that it takes care of your request and figures out that it needs to ads a boundary, axios will do the same, but needs a valid FormData.

Leave a comment