Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

186
Views
How can i set content type multipart form data in axios

I have a problem with axios, i cant set content type to multipart/form-data. here's my code

  function (config) {
    // Do something before request is sent
    const isLogin = authService.isLogin();
    if (isLogin) {
      const _auth = JSON.parse(isLogin);

      // const _superadmin = `cHJhdG9tby5hLm51Z3JvaG9AZ21haWwuY29tOmJlMTNlOTE1Yjg4MzEyMmVlMGRhNzZlNzBiYWU3ZjU1OTJmMGZlZGNiZTYzNWEyZmMyMDg0MWZhOGI3ZGQ0ZWQ=`;
      config.headers["Authorization"] = authService.isLogin()
        ? "Bearer " + _auth._token
        : "";

      config.headers["Accept"] = "application/json, text/plain, */*";
      config.headers["Content-Type"] = "multipart/form-data";
    }
    return config;
  }, ```

does anyone can help me to add content-type in my header request?
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Axios does not automatically set the multipart form boundary in Node, as a result, you must use getHeaders()

like :

const res = await axios.post('https://www.example.com/post', formData, {
  headers: formData.getHeaders()
});

in your case config.getHeaders() while you are sending the request

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!