Files
curlconverter/test/fixtures/node-axios/post_with_browser_headers.js
Boris Verkhovskiy dda866a741 axios.post .put and .patch expect data as the second argument (#393)
* axios.post .put .patch take data as the 2nd arg

* rename formData to form

* add warning about data not being sent

* sort imports properly

* passing an object as data sends it as json, not urlencoded
2022-04-21 15:19:36 -07:00

20 lines
774 B
JavaScript
Generated

const axios = require('axios');
const response = await axios.post(
'http://localhost:28139/ajax/demo_post.asp',
'',
{
headers: {
'Origin': 'http://www.w3schools.com',
'Accept-Encoding': 'gzip, deflate',
'Accept-Language': 'en-US,en;q=0.8',
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36',
'Accept': '*/*',
'Referer': 'http://www.w3schools.com/ajax/tryit_view.asp?x=0.07944501144811511',
'Cookie': '_gat=1; ASPSESSIONIDACCRDTDC=MCMDKFMBLLLHGKCGNMKNGPKI; _ga=GA1.2.1424920226.1419478126',
'Connection': 'keep-alive',
'Content-Length': '0'
}
}
);