question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Send multipart/form-data with axios in nodejs

See original GitHub issue

From the documentation of axios it seems that nodejs doesn’t natively support FormData objects

// data is the data to be sent as the request body // Only applicable for request methods 'PUT', 'POST', and 'PATCH' // When no transformRequest is set, must be of one of the following types: // - string, plain object, ArrayBuffer, ArrayBufferView, URLSearchParams // - Browser only: FormData, File, Blob // - Node only: Stream data: { firstName: 'Fred' },

So if I want to use axios in a jasmine test running with nodejs, then how would I go ahead and post a multipart/formdata object to a website?

Thanks for your help…

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:33
  • Comments:24 (1 by maintainers)

github_iconTop GitHub Comments

149reactions
rubennortecommented, Apr 2, 2017

You can do it manually in Node.js but we don’t support it natively in axios for the moment.

70reactions
binkicommented, Aug 4, 2017

For people like me who google and end up here without having a hint on how to do this manually in nodejs, I wrote a small example using the form-data package.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Post form data with axios in Node.js - Stack Overflow
You can send multipart/form-data data with Axios in Node by using FormData ... axios library does not support posting form data in Node.js....
Read more >
Send a File With Axios in Node.js - Maxim Orlov
Everything you need to know about sending files with axios in Node.js — from ... element with encoding type set to "multipart/form-data" in...
Read more >
Axios Multipart Form Data - Sending File Through a Form with ...
In this guide, we'll take a look at how to asynchronously send files and other form data with Axios to a Node.js (Express)...
Read more >
Node.js Sending Multipart/form-data from server side(backend ...
Node.js Sending Multipart/form-data from server side(backend) using axios and node-fetch.
Read more >
Axios Multipart Form Data- Sending File Through A Form With ...
From the process of sending the form data and files to Node.js (Express) using Axios to receiving it, we'll focus on it all....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found