mirror of
https://github.com/curlconverter/curlconverter.git
synced 2022-05-22 02:35:29 +03:00
* 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
23 lines
789 B
JavaScript
Generated
23 lines
789 B
JavaScript
Generated
const axios = require('axios');
|
|
|
|
const response = await axios.post(
|
|
'http://localhost:28139/echo/html/',
|
|
new URLSearchParams({
|
|
'msg1': 'wow',
|
|
'msg2': 'such'
|
|
}),
|
|
{
|
|
headers: {
|
|
'Origin': 'http://fiddle.jshell.net',
|
|
'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',
|
|
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
|
'Accept': '*/*',
|
|
'Referer': 'http://fiddle.jshell.net/_display/',
|
|
'X-Requested-With': 'XMLHttpRequest',
|
|
'Connection': 'keep-alive'
|
|
}
|
|
}
|
|
);
|