Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

postForm fails with "source.on is not a function" when using Buffer or Uint8Array in Node 18 #4727

Copy link
Copy link

Description

@smares
Issue body actions

Describe the issue

Passing Uint8Array or Buffer to postForm results in "source.on is not a function" exception.

Example Code

const data = Uint8Array.from([1, 2, 3])
axios.postForm('http://some.url', { data })

// or

const data = Uint8Array.from([1, 2, 3])
axios.postForm('http://some.url', { data: Buffer.from(data) })

Expected behavior, if applicable

axios should POST a field "data" with the content of the Uint8Array / Buffer

Environment

  • Axios Version 0.27.2
  • Node.js Version 18.2.0
  • OS: Windows 11

Additional context/Screenshots

Code is compiled from TypeScript using typescript 4.6.4 and a tsconfig.json that extends @tsconfig/node18/tsconfig.json

I am trying to upload the PDF output of puppeteer.

What am I doing wrong?

Reactions are currently unavailable

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

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.