So I have this code:
axios({
method: \'post\',
url,
headers: { \'Content-Type\': \'application/x-www-form-urlencoded\' },
data: {
jso
From the documentation (I haven't preserved links in the quoted material):
Using application/x-www-form-urlencoded format
By default, axios serializes JavaScript objects to JSON. To send data in the application/x-www-form-urlencoded format instead, you can use one of the following options.
Browser
In a browser, you can use the URLSearchParams API as follows:
var params = new URLSearchParams(); params.append('param1', 'value1'); params.append('param2', 'value2'); axios.post('/foo', params);Note that URLSearchParams is not supported by all browsers, but there is a polyfill available (make sure to polyfill the global environment).
Alternatively, you can encode data using the qs library:
var qs = require('qs'); axios.post('/foo', qs.stringify({ 'bar': 123 }));