Created
November 5, 2020 07:16
-
-
Save clarencetw/3a2123923b7c33032c9fc4f3366033f2 to your computer and use it in GitHub Desktop.
Axios post x-www-form-urlencoded
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const axios = require('axios') | |
const qs = require('querystring') | |
const requestBody = { | |
name: 'name', | |
} | |
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 | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment