Skip to content

Content type changed from multipart/form-data to application/x-www-form-urlencoded #5067

@Flamenco

Description

@Flamenco

My content-type header of multipart/form-data is getting replaced with another content-type. This was not an issue until I switched to v1.0.x

const api = axios.create({
 headers: {
  'Content-Type': 'application/json'
 }
})

const formData = new FormData()
formData.append('file', file)
api.post('endpoint', formData, {
  headers: {
   'Content-Type': 'multipart/form-data'
 }
})

However, this works:

axios({
 url: 'endpoint',
 method: 'post',
 data: formData,
 headers: {
   'Content-Type': 'multipart/form-data'
 }
})

This was sent with the old version, and the workaround mentioned:
Screen Shot 2022-10-08 at 4 46 55 PM

And this started happening when I upgraded.

Screen Shot 2022-10-08 at 4 46 40 PM

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions