Skip to content

FormData request header doesn't include boundary #4631

@kubajmarek

Description

@kubajmarek

Describe the bug

Boundary is included in payload, but it's missing in Content-Type header - it's just multipart/form-data.

To Reproduce

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>Axios issue with form-data</title>
    <script src="https://unpkg.com/axios@0.27.1/dist/axios.min.js"></script>
  </head>
  <body>
    <script>
      (async () => {
        await axios.postForm('http://localhost:8080/', { a: 'b' });
      })();
    </script>
  </body>
</html>

Screenshot 2022-04-26 at 12 53 19
Screenshot 2022-04-26 at 12 53 27

Expected behavior

Content-Type header should have a boundary.

Environment

  • Axios Version [0.27.0/0.27.1]
  • Adapter [n/a]
  • Browser [Chrome]
  • Browser Version [100.0.4896.127]
  • Node.js Version [n/a]
  • OS: [MacOS 12.3.1]
  • Additional Library Versions [n/a]

Additional context/Screenshots

n/a

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