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

323
Views
Axios - HTTP 415 Unsupported Media Type

I've to make a POST request to localhost:8080/api/session, sending email and password as x-www-form-urlencoded. In Postman, everything works, but trying two different solutions with Axios, I obtain 415-Unsopported Media Type First solution:

var request_url = url + request.path;
var params = new URLSearchParams();
params.append('email', 'example@example.com');
params.append('password', 'example');
axios.post(request_url, params)
.then(res => {
    console.log("ok")
})
.catch(error => {
  console.error(error)
})

Second solution:

const data = qs.stringify({
email: 'example@example.com',
password: 'example',
});

const headers = {
    'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
};


axios.post(
    'http://10.10.0.145/api/session',
    data,
    headers
  ).then(result => {console.log("ok")});

What am I doing wrong?

about 4 years ago · Juan Pablo Isaza
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!