Answers for "axios json content type or x-www-form-urlencoded"

2

axios post urlencoded

const axios = require('axios')
const qs = require('querystring')

...

const requestBody = {
  name: 'Akexorcist',
  age: '28',
  position: 'Android Developer',
  description: 'birthdate=25-12-1989&favourite=coding%20coding%20and%20coding&company=Nextzy%20Technologies&website=http://www.akexorcist.com/',
  awesome: true
}

const config = {
  headers: {
    'Content-Type': 'application/x-www-form-urlencoded'
  }
}

axios.post(url, qs.stringify(requestBody), config)
  .then((result) => {
    // Do somthing
  })
  .catch((err) => {
    // Do somthing
  })
Posted by: Guest on June-05-2020

Code answers related to "axios json content type or x-www-form-urlencoded"

Code answers related to "Javascript"

Browse Popular Code Answers by Language