mirror of
https://github.com/curlconverter/curlconverter.git
synced 2022-05-22 02:35:29 +03:00
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
This commit is contained in:
committed by
GitHub
parent
2d9ff6f0aa
commit
dda866a741
15
test/fixtures/node-axios/delete_content_type.js
generated
vendored
15
test/fixtures/node-axios/delete_content_type.js
generated
vendored
@@ -1,8 +1,11 @@
|
||||
const axios = require('axios');
|
||||
|
||||
const response = await axios.post('localhost:28139', {
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
data: JSON.stringify({})
|
||||
});
|
||||
const response = await axios.post(
|
||||
'localhost:28139',
|
||||
{},
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
2
test/fixtures/node-axios/get_url_starting_with_http.js
generated
vendored
2
test/fixtures/node-axios/get_url_starting_with_http.js
generated
vendored
@@ -1,3 +1,3 @@
|
||||
const axios = require('axios');
|
||||
|
||||
const response = await axios('httpbin.org/test');
|
||||
const response = await axios.get('httpbin.org/test');
|
||||
|
||||
17
test/fixtures/node-axios/get_with_all_numerical_data.js
generated
vendored
17
test/fixtures/node-axios/get_with_all_numerical_data.js
generated
vendored
@@ -1,9 +1,12 @@
|
||||
const axios = require('axios');
|
||||
|
||||
const response = await axios.post('http://localhost:28139/CurlToNode', {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json'
|
||||
},
|
||||
data: JSON.stringify(18233982904)
|
||||
});
|
||||
const response = await axios.post(
|
||||
'http://localhost:28139/CurlToNode',
|
||||
'18233982904',
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json'
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
22
test/fixtures/node-axios/get_with_data2.js
generated
vendored
22
test/fixtures/node-axios/get_with_data2.js
generated
vendored
@@ -1,12 +1,16 @@
|
||||
const axios = require('axios');
|
||||
|
||||
const response = await axios.put('http://localhost:28139/v2/alerts_policy_channels.json', {
|
||||
params: {
|
||||
'policy_id': 'policy_id',
|
||||
'channel_ids': 'channel_id'
|
||||
},
|
||||
headers: {
|
||||
'X-Api-Key': '{admin_api_key}',
|
||||
'Content-Type': 'application/json'
|
||||
const response = await axios.put(
|
||||
'http://localhost:28139/v2/alerts_policy_channels.json',
|
||||
'',
|
||||
{
|
||||
params: {
|
||||
'policy_id': 'policy_id',
|
||||
'channel_ids': 'channel_id'
|
||||
},
|
||||
headers: {
|
||||
'X-Api-Key': '{admin_api_key}',
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
}
|
||||
});
|
||||
);
|
||||
|
||||
28
test/fixtures/node-axios/get_with_form.js
generated
vendored
28
test/fixtures/node-axios/get_with_form.js
generated
vendored
@@ -1,15 +1,21 @@
|
||||
const axios = require('axios');
|
||||
const FormData = require('form-data');
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append('from', 'test@tester.com');
|
||||
formData.append('to', 'devs@tester.net');
|
||||
formData.append('subject', 'Hello');
|
||||
formData.append('text', 'Testing the converter!');
|
||||
const form = new FormData();
|
||||
form.append('from', 'test@tester.com');
|
||||
form.append('to', 'devs@tester.net');
|
||||
form.append('subject', 'Hello');
|
||||
form.append('text', 'Testing the converter!');
|
||||
|
||||
const response = await axios.post('http://localhost:28139/v3', {
|
||||
auth: {
|
||||
username: 'test'
|
||||
},
|
||||
data: formData
|
||||
});
|
||||
const response = await axios.post(
|
||||
'http://localhost:28139/v3',
|
||||
form,
|
||||
{
|
||||
headers: {
|
||||
...form.getHeaders()
|
||||
},
|
||||
auth: {
|
||||
username: 'test'
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
12
test/fixtures/node-axios/j_data_priority_than_f.js
generated
vendored
12
test/fixtures/node-axios/j_data_priority_than_f.js
generated
vendored
@@ -1,12 +1,10 @@
|
||||
const axios = require('axios');
|
||||
|
||||
const response = await axios.post('http://localhost:28139/post', {
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
data: {
|
||||
const response = await axios.post(
|
||||
'http://localhost:28139/post',
|
||||
new URLSearchParams({
|
||||
'data1': 'data1',
|
||||
'data2': 'data2',
|
||||
'data3': 'data3'
|
||||
}
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
15
test/fixtures/node-axios/j_patch_array.js
generated
vendored
15
test/fixtures/node-axios/j_patch_array.js
generated
vendored
@@ -1,8 +1,11 @@
|
||||
const axios = require('axios');
|
||||
|
||||
const response = await axios.patch('http://localhost:28139/patch', {
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
data: 'item[]=1&item[]=2&item[]=3'
|
||||
});
|
||||
const response = await axios.patch(
|
||||
'http://localhost:28139/patch',
|
||||
'item[]=1&item[]=2&item[]=3',
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
16
test/fixtures/node-axios/j_patch_file_only.js
generated
vendored
16
test/fixtures/node-axios/j_patch_file_only.js
generated
vendored
@@ -2,9 +2,15 @@ const axios = require('axios');
|
||||
const FormData = require('form-data');
|
||||
const fs = require('fs');
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append('file1', fs.readFileSync('./fixtures/curl_commands/delete.sh'), './fixtures/curl_commands/delete.sh');
|
||||
const form = new FormData();
|
||||
form.append('file1', fs.readFileSync('./fixtures/curl_commands/delete.sh'), './fixtures/curl_commands/delete.sh');
|
||||
|
||||
const response = await axios.patch('http://localhost:28139/patch', {
|
||||
data: formData
|
||||
});
|
||||
const response = await axios.patch(
|
||||
'http://localhost:28139/patch',
|
||||
form,
|
||||
{
|
||||
headers: {
|
||||
...form.getHeaders()
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
20
test/fixtures/node-axios/j_patch_file_with_data.js
generated
vendored
20
test/fixtures/node-axios/j_patch_file_with_data.js
generated
vendored
@@ -2,11 +2,17 @@ const axios = require('axios');
|
||||
const FormData = require('form-data');
|
||||
const fs = require('fs');
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append('file1', fs.readFileSync('./fixtures/curl_commands/delete.sh'), './fixtures/curl_commands/delete.sh');
|
||||
formData.append('form1', 'form+data+1');
|
||||
formData.append('form2', 'form_data_2');
|
||||
const form = new FormData();
|
||||
form.append('file1', fs.readFileSync('./fixtures/curl_commands/delete.sh'), './fixtures/curl_commands/delete.sh');
|
||||
form.append('form1', 'form+data+1');
|
||||
form.append('form2', 'form_data_2');
|
||||
|
||||
const response = await axios.patch('http://localhost:28139/patch', {
|
||||
data: formData
|
||||
});
|
||||
const response = await axios.patch(
|
||||
'http://localhost:28139/patch',
|
||||
form,
|
||||
{
|
||||
headers: {
|
||||
...form.getHeaders()
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
12
test/fixtures/node-axios/j_post_data_wo_verb.js
generated
vendored
12
test/fixtures/node-axios/j_post_data_wo_verb.js
generated
vendored
@@ -1,12 +1,10 @@
|
||||
const axios = require('axios');
|
||||
|
||||
const response = await axios.post('http://localhost:28139/post', {
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
data: {
|
||||
const response = await axios.post(
|
||||
'http://localhost:28139/post',
|
||||
new URLSearchParams({
|
||||
'data1': 'data1',
|
||||
'data2': 'data2',
|
||||
'data3': 'data3'
|
||||
}
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
18
test/fixtures/node-axios/j_post_form_f.js
generated
vendored
18
test/fixtures/node-axios/j_post_form_f.js
generated
vendored
@@ -1,10 +1,16 @@
|
||||
const axios = require('axios');
|
||||
const FormData = require('form-data');
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append('d1', 'data1');
|
||||
formData.append('d2', 'data');
|
||||
const form = new FormData();
|
||||
form.append('d1', 'data1');
|
||||
form.append('d2', 'data');
|
||||
|
||||
const response = await axios.post('http://localhost:28139/post', {
|
||||
data: formData
|
||||
});
|
||||
const response = await axios.post(
|
||||
'http://localhost:28139/post',
|
||||
form,
|
||||
{
|
||||
headers: {
|
||||
...form.getHeaders()
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
7
test/fixtures/node-axios/multiline_post_with_data.js
generated
vendored
7
test/fixtures/node-axios/multiline_post_with_data.js
generated
vendored
@@ -2,11 +2,10 @@ const axios = require('axios');
|
||||
|
||||
const response = await axios.get('http://localhost:28139/echo/html/', {
|
||||
headers: {
|
||||
'Origin': 'http://fiddle.jshell.net',
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
'Origin': 'http://fiddle.jshell.net'
|
||||
},
|
||||
data: {
|
||||
data: new URLSearchParams({
|
||||
'msg1': 'value1',
|
||||
'msg2': 'value2'
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
22
test/fixtures/node-axios/multipart_post.js
generated
vendored
22
test/fixtures/node-axios/multipart_post.js
generated
vendored
@@ -2,13 +2,17 @@ const axios = require('axios');
|
||||
const FormData = require('form-data');
|
||||
const fs = require('fs');
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append('attributes', '{"name":"tigers.jpeg", "parent":{"id":"11446498"}}');
|
||||
formData.append('file', fs.readFileSync('myfile.jpg'), 'myfile.jpg');
|
||||
const form = new FormData();
|
||||
form.append('attributes', '{"name":"tigers.jpeg", "parent":{"id":"11446498"}}');
|
||||
form.append('file', fs.readFileSync('myfile.jpg'), 'myfile.jpg');
|
||||
|
||||
const response = await axios.post('https://localhost:28139/api/2.0/files/content', {
|
||||
headers: {
|
||||
'Authorization': 'Bearer ACCESS_TOKEN'
|
||||
},
|
||||
data: formData
|
||||
});
|
||||
const response = await axios.post(
|
||||
'https://localhost:28139/api/2.0/files/content',
|
||||
form,
|
||||
{
|
||||
headers: {
|
||||
...form.getHeaders(),
|
||||
'Authorization': 'Bearer ACCESS_TOKEN'
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
24
test/fixtures/node-axios/multipart_with_headers.js
generated
vendored
24
test/fixtures/node-axios/multipart_with_headers.js
generated
vendored
@@ -2,14 +2,18 @@ const axios = require('axios');
|
||||
const FormData = require('form-data');
|
||||
const fs = require('fs');
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append('attributes', '{"name":"tigers.jpeg", "parent":{"id":"11446498"}}');
|
||||
formData.append('file', fs.readFileSync('myfile.jpg'), 'myfile.jpg');
|
||||
const form = new FormData();
|
||||
form.append('attributes', '{"name":"tigers.jpeg", "parent":{"id":"11446498"}}');
|
||||
form.append('file', fs.readFileSync('myfile.jpg'), 'myfile.jpg');
|
||||
|
||||
const response = await axios.post('https://localhost:28139/api/2.0/files/content', {
|
||||
headers: {
|
||||
'Authorization': 'Bearer ACCESS_TOKEN',
|
||||
'X-Nice': 'Header'
|
||||
},
|
||||
data: formData
|
||||
});
|
||||
const response = await axios.post(
|
||||
'https://localhost:28139/api/2.0/files/content',
|
||||
form,
|
||||
{
|
||||
headers: {
|
||||
...form.getHeaders(),
|
||||
'Authorization': 'Bearer ACCESS_TOKEN',
|
||||
'X-Nice': 'Header'
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
15
test/fixtures/node-axios/multiple_d_post.js
generated
vendored
15
test/fixtures/node-axios/multiple_d_post.js
generated
vendored
@@ -1,8 +1,11 @@
|
||||
const axios = require('axios');
|
||||
|
||||
const response = await axios.post('https://localhost:28139/webservices/rest.php', {
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
data: 'version=1.2&auth_user=fdgxf&auth_pwd=oxfdscds&json_data={ "operation": "core/get", "class": "Software", "key": "key" }'
|
||||
});
|
||||
const response = await axios.post(
|
||||
'https://localhost:28139/webservices/rest.php',
|
||||
'version=1.2&auth_user=fdgxf&auth_pwd=oxfdscds&json_data={ "operation": "core/get", "class": "Software", "key": "key" }',
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
29
test/fixtures/node-axios/patch.js
generated
vendored
29
test/fixtures/node-axios/patch.js
generated
vendored
@@ -1,16 +1,9 @@
|
||||
const axios = require('axios');
|
||||
|
||||
const response = await axios.patch('http://localhost:28139/go/api/agents/adb9540a-b954-4571-9d9b-2f330739d4da', {
|
||||
headers: {
|
||||
'Accept': 'application/vnd.go.cd.v4+json',
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
auth: {
|
||||
username: 'username',
|
||||
password: 'password'
|
||||
},
|
||||
// data: '{\n "hostname": "agent02.example.com",\n "agent_config_state": "Enabled",\n "resources": ["Java","Linux"],\n "environments": ["Dev"]\n }',
|
||||
data: JSON.stringify({
|
||||
const response = await axios.patch(
|
||||
'http://localhost:28139/go/api/agents/adb9540a-b954-4571-9d9b-2f330739d4da',
|
||||
// '{\n "hostname": "agent02.example.com",\n "agent_config_state": "Enabled",\n "resources": ["Java","Linux"],\n "environments": ["Dev"]\n }',
|
||||
{
|
||||
'hostname': 'agent02.example.com',
|
||||
'agent_config_state': 'Enabled',
|
||||
'resources': [
|
||||
@@ -20,5 +13,15 @@ const response = await axios.patch('http://localhost:28139/go/api/agents/adb9540
|
||||
'environments': [
|
||||
'Dev'
|
||||
]
|
||||
})
|
||||
});
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
'Accept': 'application/vnd.go.cd.v4+json',
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
auth: {
|
||||
username: 'username',
|
||||
password: 'password'
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
20
test/fixtures/node-axios/post_basic_auth_url_encoded_data.js
generated
vendored
20
test/fixtures/node-axios/post_basic_auth_url_encoded_data.js
generated
vendored
@@ -1,14 +1,14 @@
|
||||
const axios = require('axios');
|
||||
|
||||
const response = await axios.post('http://localhost:28139/api/oauth/token/', {
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
auth: {
|
||||
username: 'foo',
|
||||
password: 'bar'
|
||||
},
|
||||
data: {
|
||||
const response = await axios.post(
|
||||
'http://localhost:28139/api/oauth/token/',
|
||||
new URLSearchParams({
|
||||
'grant_type': 'client_credentials'
|
||||
}),
|
||||
{
|
||||
auth: {
|
||||
username: 'foo',
|
||||
password: 'bar'
|
||||
}
|
||||
}
|
||||
});
|
||||
);
|
||||
|
||||
17
test/fixtures/node-axios/post_binary_file.js
generated
vendored
17
test/fixtures/node-axios/post_binary_file.js
generated
vendored
@@ -1,9 +1,12 @@
|
||||
const axios = require('axios');
|
||||
|
||||
const response = await axios.post('http://localhost:28139/american-art/query', {
|
||||
headers: {
|
||||
'Content-type': 'application/sparql-query',
|
||||
'Accept': 'application/sparql-results+json'
|
||||
},
|
||||
data: '@./sample.sparql'
|
||||
});
|
||||
const response = await axios.post(
|
||||
'http://localhost:28139/american-art/query',
|
||||
'@./sample.sparql',
|
||||
{
|
||||
headers: {
|
||||
'Content-type': 'application/sparql-query',
|
||||
'Accept': 'application/sparql-results+json'
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
67
test/fixtures/node-axios/post_data_binary_with_equals.js
generated
vendored
67
test/fixtures/node-axios/post_data_binary_with_equals.js
generated
vendored
@@ -1,35 +1,8 @@
|
||||
const axios = require('axios');
|
||||
|
||||
const response = await axios.post('http://localhost:28139/api/service.svc', {
|
||||
params: {
|
||||
'action': 'CreateItem',
|
||||
'ID': '-37',
|
||||
'AC': '1'
|
||||
},
|
||||
headers: {
|
||||
'Cookie': 'X-BackEndCookie=S-1-5-21-1234556-56678-12345-2345=alphanumericstring12345/anotheralphanumericstring12345/scsiAdf/P; ClientId=LoremIupsum; PrivateComputer=true; PBack=0; cadata=bx88rrCBehITlBWSozO2l2hlFGu//JjT1/k6dewX5shV32jANUZSMU6GR+M25B6YpBODEgXzxfIHDnvxNC6SJoaE/d8RWX3uDnbkd+m91jNhMXNSYIRYTJHVFdPG06AE; cadataTTL=NfDhBViTJMUdC+ir+6BYvg==; cadataKey=qUY+OLTD9V14CFK6/CUPyrJWMxl1FFqZFjB8/qcS0/q55eqGvP9bWvX+XuSYVv3hIGAn9QNPhIDK6NP9LwCBdu25f2BUFDUWJruGO8MW02izSWzRUnni00xWQq3Y3nNKvpvO+OIR641BPHVZ0+lzCw2Wt8uzEnryCWAjlleozF/XWjpTN4/AaTmcIjEZUDN+fo4494rD0mADtEHv2gmd5mhLe+iyii/L9nAB3UuiJomwbRbKgy22Tj8cyavmLC4ZaViqW9E102NOLU4FYLgdZVET+mbdg==; cadataIV=bTM88YL1zmz7FsBEB0y3nI2SrdSTy+KLxCpx2FRfIZYFo2spN1IHQMSCT76OXrg79sVPhyqXk+N9rOj6M9KsQl4KqMNVBcoXgp24POpgoTwd4FBmKtAYbd9SDErna3jrMO168ML9PDG18K3CnBf6YG1tsIs0gXOEP9LzHVmUPF7KCKqUFiOiZGWuwmPhl85eo77BbEpVN2JkPnzuQWn6tC0cY4f2cJDlr3Z23SrAUVwwXmgRg2DXfOF5MIEkpwYiiI6sABCD9rsSnE6zTXlvZg33hjiD/ywUV1ZWjI2M/4zBixa4s150+dOnMmvtEFs/nOMnvMJui4PEDlTA==; cadataSig=WL3hB+av7sO3bzjL+Efe5b4exnvQxSInH3U5jDvfnPcttSp0XUF3y/NB573C0CTBYuOH/40smFssXlrKhT9tG2ITivdSIIamOmarmC8XwFOv9qQIFMHofcO/jjRDMqF0qRk7WBAC2FgBQrf2Tvq7wk5IX/JHn6zhlgKALAAqH9L9JNC244etnjj9YNaMDYEHV2M2jVTu3FsELqw1rSSqp0hEBlh+aFBvYCBg5hS1mVI76ZCHZVa0OUejiH2yiZyJIKHUI+Sv0rpU3iiQNtIFmGEdwhoo/rga4s4Dc2UsJLQ8c0yGlZgflYs+7Q5gPr74/mTUin60ej/w3M0roUl3FQ==; UC=d8be544621964f3c9865b3ee872fd432; AppcacheVer=15.0.1236.3:en-usbase; X-OWA-CANARY=VOXQP6xtGkiNnv7E4rFt8TrmclqVFtQI4IJqZflrR7Wz9AMPkMsFoyAlquw1YGsTUxIkVouAcvk.',
|
||||
'Origin': 'https://nih.mail.edu.fr',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'X-EWS-TargetVersion': '2.5',
|
||||
'Accept-Language': 'en-US,en;q=0.8',
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36',
|
||||
'Action': 'CreateItem',
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
'Connection': 'keep-alive',
|
||||
'X-OWA-CANARY': 'VOXQP6xtGkiNnv7E4rFt8TrmclqVFtQI4IJqZflrR7Wz9AMPkMsFoyAlquw1YGsTUxIkVouAcvk.',
|
||||
'X-OWA-ActionName': 'CreateMessageForComposeSend',
|
||||
'X-OWA-ActionId': '-37',
|
||||
'X-OWA-ServiceUnavailableOnTransientError': 'true',
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
'Accept': '*/*',
|
||||
'Referer': 'https://localhost/api/',
|
||||
'X-OWA-ClientBuildVersion': '15.0.1236.3',
|
||||
'X-OWA-CorrelationId': '2f11f8fb-f6c6-43a5-881d-8a1b242a4e70_148023102251337',
|
||||
'DNT': '1',
|
||||
'X-OWA-ClientBegin': '2016-11-27T07:17:02.513',
|
||||
'X-OWA-Attempt': '1'
|
||||
},
|
||||
data: JSON.stringify({
|
||||
const response = await axios.post(
|
||||
'http://localhost:28139/api/service.svc',
|
||||
{
|
||||
'__type': 'CreateItemJsonRequest:#Exchange',
|
||||
'Header': {
|
||||
'__type': 'JsonRequestHeaders:#Exchange',
|
||||
@@ -77,5 +50,35 @@ const response = await axios.post('http://localhost:28139/api/service.svc', {
|
||||
'MessageDisposition': 'SendAndSaveCopy',
|
||||
'ComposeOperation': 'newMail'
|
||||
}
|
||||
})
|
||||
});
|
||||
},
|
||||
{
|
||||
params: {
|
||||
'action': 'CreateItem',
|
||||
'ID': '-37',
|
||||
'AC': '1'
|
||||
},
|
||||
headers: {
|
||||
'Cookie': 'X-BackEndCookie=S-1-5-21-1234556-56678-12345-2345=alphanumericstring12345/anotheralphanumericstring12345/scsiAdf/P; ClientId=LoremIupsum; PrivateComputer=true; PBack=0; cadata=bx88rrCBehITlBWSozO2l2hlFGu//JjT1/k6dewX5shV32jANUZSMU6GR+M25B6YpBODEgXzxfIHDnvxNC6SJoaE/d8RWX3uDnbkd+m91jNhMXNSYIRYTJHVFdPG06AE; cadataTTL=NfDhBViTJMUdC+ir+6BYvg==; cadataKey=qUY+OLTD9V14CFK6/CUPyrJWMxl1FFqZFjB8/qcS0/q55eqGvP9bWvX+XuSYVv3hIGAn9QNPhIDK6NP9LwCBdu25f2BUFDUWJruGO8MW02izSWzRUnni00xWQq3Y3nNKvpvO+OIR641BPHVZ0+lzCw2Wt8uzEnryCWAjlleozF/XWjpTN4/AaTmcIjEZUDN+fo4494rD0mADtEHv2gmd5mhLe+iyii/L9nAB3UuiJomwbRbKgy22Tj8cyavmLC4ZaViqW9E102NOLU4FYLgdZVET+mbdg==; cadataIV=bTM88YL1zmz7FsBEB0y3nI2SrdSTy+KLxCpx2FRfIZYFo2spN1IHQMSCT76OXrg79sVPhyqXk+N9rOj6M9KsQl4KqMNVBcoXgp24POpgoTwd4FBmKtAYbd9SDErna3jrMO168ML9PDG18K3CnBf6YG1tsIs0gXOEP9LzHVmUPF7KCKqUFiOiZGWuwmPhl85eo77BbEpVN2JkPnzuQWn6tC0cY4f2cJDlr3Z23SrAUVwwXmgRg2DXfOF5MIEkpwYiiI6sABCD9rsSnE6zTXlvZg33hjiD/ywUV1ZWjI2M/4zBixa4s150+dOnMmvtEFs/nOMnvMJui4PEDlTA==; cadataSig=WL3hB+av7sO3bzjL+Efe5b4exnvQxSInH3U5jDvfnPcttSp0XUF3y/NB573C0CTBYuOH/40smFssXlrKhT9tG2ITivdSIIamOmarmC8XwFOv9qQIFMHofcO/jjRDMqF0qRk7WBAC2FgBQrf2Tvq7wk5IX/JHn6zhlgKALAAqH9L9JNC244etnjj9YNaMDYEHV2M2jVTu3FsELqw1rSSqp0hEBlh+aFBvYCBg5hS1mVI76ZCHZVa0OUejiH2yiZyJIKHUI+Sv0rpU3iiQNtIFmGEdwhoo/rga4s4Dc2UsJLQ8c0yGlZgflYs+7Q5gPr74/mTUin60ej/w3M0roUl3FQ==; UC=d8be544621964f3c9865b3ee872fd432; AppcacheVer=15.0.1236.3:en-usbase; X-OWA-CANARY=VOXQP6xtGkiNnv7E4rFt8TrmclqVFtQI4IJqZflrR7Wz9AMPkMsFoyAlquw1YGsTUxIkVouAcvk.',
|
||||
'Origin': 'https://nih.mail.edu.fr',
|
||||
'Accept-Encoding': 'gzip, deflate, br',
|
||||
'X-EWS-TargetVersion': '2.5',
|
||||
'Accept-Language': 'en-US,en;q=0.8',
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36',
|
||||
'Action': 'CreateItem',
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
'Connection': 'keep-alive',
|
||||
'X-OWA-CANARY': 'VOXQP6xtGkiNnv7E4rFt8TrmclqVFtQI4IJqZflrR7Wz9AMPkMsFoyAlquw1YGsTUxIkVouAcvk.',
|
||||
'X-OWA-ActionName': 'CreateMessageForComposeSend',
|
||||
'X-OWA-ActionId': '-37',
|
||||
'X-OWA-ServiceUnavailableOnTransientError': 'true',
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
'Accept': '*/*',
|
||||
'Referer': 'https://localhost/api/',
|
||||
'X-OWA-ClientBuildVersion': '15.0.1236.3',
|
||||
'X-OWA-CorrelationId': '2f11f8fb-f6c6-43a5-881d-8a1b242a4e70_148023102251337',
|
||||
'DNT': '1',
|
||||
'X-OWA-ClientBegin': '2016-11-27T07:17:02.513',
|
||||
'X-OWA-Attempt': '1'
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
12
test/fixtures/node-axios/post_empty.js
generated
vendored
12
test/fixtures/node-axios/post_empty.js
generated
vendored
@@ -1,7 +1,11 @@
|
||||
const axios = require('axios');
|
||||
|
||||
const response = await axios.post('http://localhost:28139', {
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
const response = await axios.post(
|
||||
'http://localhost:28139',
|
||||
'',
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
}
|
||||
}
|
||||
});
|
||||
);
|
||||
|
||||
15
test/fixtures/node-axios/post_escaped_double_quotes_in_single_quotes.js
generated
vendored
15
test/fixtures/node-axios/post_escaped_double_quotes_in_single_quotes.js
generated
vendored
@@ -1,8 +1,11 @@
|
||||
const axios = require('axios');
|
||||
|
||||
const response = await axios.post('http://localhost:28139/', {
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
data: 'foo=\\"bar\\"'
|
||||
});
|
||||
const response = await axios.post(
|
||||
'http://localhost:28139/',
|
||||
'foo=\\"bar\\"',
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
15
test/fixtures/node-axios/post_escaped_single_quotes_in_double_quotes.js
generated
vendored
15
test/fixtures/node-axios/post_escaped_single_quotes_in_double_quotes.js
generated
vendored
@@ -1,8 +1,11 @@
|
||||
const axios = require('axios');
|
||||
|
||||
const response = await axios.post('http://localhost:28139/', {
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
data: 'foo=\\\'bar\\\''
|
||||
});
|
||||
const response = await axios.post(
|
||||
'http://localhost:28139/',
|
||||
'foo=\\\'bar\\\'',
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
18
test/fixtures/node-axios/post_form.js
generated
vendored
18
test/fixtures/node-axios/post_form.js
generated
vendored
@@ -1,10 +1,16 @@
|
||||
const axios = require('axios');
|
||||
const FormData = require('form-data');
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append('username', 'davidwalsh');
|
||||
formData.append('password', 'something');
|
||||
const form = new FormData();
|
||||
form.append('username', 'davidwalsh');
|
||||
form.append('password', 'something');
|
||||
|
||||
const response = await axios.post('http://localhost:28139/post-to-me.php', {
|
||||
data: formData
|
||||
});
|
||||
const response = await axios.post(
|
||||
'http://localhost:28139/post-to-me.php',
|
||||
form,
|
||||
{
|
||||
headers: {
|
||||
...form.getHeaders()
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
16
test/fixtures/node-axios/post_image.js
generated
vendored
16
test/fixtures/node-axios/post_image.js
generated
vendored
@@ -2,9 +2,15 @@ const axios = require('axios');
|
||||
const FormData = require('form-data');
|
||||
const fs = require('fs');
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append('image', fs.readFileSync('image.jpg'), 'image.jpg');
|
||||
const form = new FormData();
|
||||
form.append('image', fs.readFileSync('image.jpg'), 'image.jpg');
|
||||
|
||||
const response = await axios.post('http://localhost:28139/targetservice', {
|
||||
data: formData
|
||||
});
|
||||
const response = await axios.post(
|
||||
'http://localhost:28139/targetservice',
|
||||
form,
|
||||
{
|
||||
headers: {
|
||||
...form.getHeaders()
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
21
test/fixtures/node-axios/post_json.js
generated
vendored
21
test/fixtures/node-axios/post_json.js
generated
vendored
@@ -1,12 +1,15 @@
|
||||
const axios = require('axios');
|
||||
|
||||
const response = await axios.post('https://localhost:28139', {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json'
|
||||
},
|
||||
// data: '{ "drink": "coffe" }',
|
||||
data: JSON.stringify({
|
||||
const response = await axios.post(
|
||||
'https://localhost:28139',
|
||||
// '{ "drink": "coffe" }',
|
||||
{
|
||||
'drink': 'coffe'
|
||||
})
|
||||
});
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json'
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
21
test/fixtures/node-axios/post_json_multiple_headers.js
generated
vendored
21
test/fixtures/node-axios/post_json_multiple_headers.js
generated
vendored
@@ -1,14 +1,17 @@
|
||||
const axios = require('axios');
|
||||
|
||||
const response = await axios.post('https://localhost:28139/rest/login-sessions', {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-API-Version': '200'
|
||||
},
|
||||
// data: '{"userName":"username123","password":"password123", "authLoginDomain":"local"}',
|
||||
data: JSON.stringify({
|
||||
const response = await axios.post(
|
||||
'https://localhost:28139/rest/login-sessions',
|
||||
// '{"userName":"username123","password":"password123", "authLoginDomain":"local"}',
|
||||
{
|
||||
'userName': 'username123',
|
||||
'password': 'password123',
|
||||
'authLoginDomain': 'local'
|
||||
})
|
||||
});
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-API-Version': '200'
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
15
test/fixtures/node-axios/post_number.js
generated
vendored
15
test/fixtures/node-axios/post_number.js
generated
vendored
@@ -1,8 +1,11 @@
|
||||
const axios = require('axios');
|
||||
|
||||
const response = await axios.post('http://localhost:28139', {
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
data: '123'
|
||||
});
|
||||
const response = await axios.post(
|
||||
'http://localhost:28139',
|
||||
'123',
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
12
test/fixtures/node-axios/post_quotes_inside_data.js
generated
vendored
12
test/fixtures/node-axios/post_quotes_inside_data.js
generated
vendored
@@ -1,10 +1,8 @@
|
||||
const axios = require('axios');
|
||||
|
||||
const response = await axios.post('localhost:28139', {
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
data: {
|
||||
const response = await axios.post(
|
||||
'localhost:28139',
|
||||
new URLSearchParams({
|
||||
'field': 'don\'t you like quotes'
|
||||
}
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
15
test/fixtures/node-axios/post_same_field_multiple_times.js
generated
vendored
15
test/fixtures/node-axios/post_same_field_multiple_times.js
generated
vendored
@@ -1,8 +1,11 @@
|
||||
const axios = require('axios');
|
||||
|
||||
const response = await axios.post('http://localhost:28139/', {
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
data: 'foo=bar&foo=&foo=barbar'
|
||||
});
|
||||
const response = await axios.post(
|
||||
'http://localhost:28139/',
|
||||
'foo=bar&foo=&foo=barbar',
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
28
test/fixtures/node-axios/post_with_browser_headers.js
generated
vendored
28
test/fixtures/node-axios/post_with_browser_headers.js
generated
vendored
@@ -1,15 +1,19 @@
|
||||
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'
|
||||
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'
|
||||
}
|
||||
}
|
||||
});
|
||||
);
|
||||
|
||||
14
test/fixtures/node-axios/post_with_colon_in_header.js
generated
vendored
14
test/fixtures/node-axios/post_with_colon_in_header.js
generated
vendored
@@ -1,8 +1,12 @@
|
||||
const axios = require('axios');
|
||||
|
||||
const response = await axios.post('http://localhost:28139/endpoint', {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'key': 'abcdefg'
|
||||
const response = await axios.post(
|
||||
'http://localhost:28139/endpoint',
|
||||
'',
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'key': 'abcdefg'
|
||||
}
|
||||
}
|
||||
});
|
||||
);
|
||||
|
||||
31
test/fixtures/node-axios/post_with_data-ascii.js
generated
vendored
31
test/fixtures/node-axios/post_with_data-ascii.js
generated
vendored
@@ -1,19 +1,22 @@
|
||||
const axios = require('axios');
|
||||
|
||||
const response = await axios.post('http://localhost:28139/echo/html/', {
|
||||
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'
|
||||
},
|
||||
data: {
|
||||
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'
|
||||
}
|
||||
}
|
||||
});
|
||||
);
|
||||
|
||||
15
test/fixtures/node-axios/post_with_data_binary.js
generated
vendored
15
test/fixtures/node-axios/post_with_data_binary.js
generated
vendored
@@ -1,8 +1,11 @@
|
||||
const axios = require('axios');
|
||||
|
||||
const response = await axios.post('http://localhost:28139/post', {
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
data: '{"title":"china1"}'
|
||||
});
|
||||
const response = await axios.post(
|
||||
'http://localhost:28139/post',
|
||||
'{"title":"china1"}',
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
15
test/fixtures/node-axios/post_with_data_raw.js
generated
vendored
15
test/fixtures/node-axios/post_with_data_raw.js
generated
vendored
@@ -1,8 +1,11 @@
|
||||
const axios = require('axios');
|
||||
|
||||
const response = await axios.post('http://localhost:28139/post', {
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
data: 'msg1=wow&msg2=such&msg3=@rawmsg'
|
||||
});
|
||||
const response = await axios.post(
|
||||
'http://localhost:28139/post',
|
||||
'msg1=wow&msg2=such&msg3=@rawmsg',
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
15
test/fixtures/node-axios/post_with_data_with_percent_sign.js
generated
vendored
15
test/fixtures/node-axios/post_with_data_with_percent_sign.js
generated
vendored
@@ -1,8 +1,11 @@
|
||||
const axios = require('axios');
|
||||
|
||||
const response = await axios.post('https://localhost:28139/post', {
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
data: 'secret=*%5*!'
|
||||
});
|
||||
const response = await axios.post(
|
||||
'https://localhost:28139/post',
|
||||
'secret=*%5*!',
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
15
test/fixtures/node-axios/post_with_double_quotes_inside_single_quotes.js
generated
vendored
15
test/fixtures/node-axios/post_with_double_quotes_inside_single_quotes.js
generated
vendored
@@ -1,8 +1,11 @@
|
||||
const axios = require('axios');
|
||||
|
||||
const response = await axios.post('http://localhost:28139/', {
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
data: 'foo="bar"'
|
||||
});
|
||||
const response = await axios.post(
|
||||
'http://localhost:28139/',
|
||||
'foo="bar"',
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
15
test/fixtures/node-axios/post_with_escaped_double_quotes.js
generated
vendored
15
test/fixtures/node-axios/post_with_escaped_double_quotes.js
generated
vendored
@@ -1,8 +1,11 @@
|
||||
const axios = require('axios');
|
||||
|
||||
const response = await axios.post('http://localhost:28139/', {
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
data: 'foo="bar"'
|
||||
});
|
||||
const response = await axios.post(
|
||||
'http://localhost:28139/',
|
||||
'foo="bar"',
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
30
test/fixtures/node-axios/post_with_extra_whitespace.js
generated
vendored
30
test/fixtures/node-axios/post_with_extra_whitespace.js
generated
vendored
@@ -2,17 +2,21 @@ const axios = require('axios');
|
||||
const FormData = require('form-data');
|
||||
const fs = require('fs');
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append('files', fs.readFileSync('47.htz'), '47.htz');
|
||||
formData.append('name', '47');
|
||||
formData.append('oldMediaId', '47');
|
||||
formData.append('updateInLayouts', '1');
|
||||
formData.append('deleteOldRevisions', '1');
|
||||
const form = new FormData();
|
||||
form.append('files', fs.readFileSync('47.htz'), '47.htz');
|
||||
form.append('name', '47');
|
||||
form.append('oldMediaId', '47');
|
||||
form.append('updateInLayouts', '1');
|
||||
form.append('deleteOldRevisions', '1');
|
||||
|
||||
const response = await axios.post('http://localhost:28139/api/library', {
|
||||
headers: {
|
||||
'accept': 'application/json',
|
||||
'Content-Type': 'multipart/form-data'
|
||||
},
|
||||
data: formData
|
||||
});
|
||||
const response = await axios.post(
|
||||
'http://localhost:28139/api/library',
|
||||
form,
|
||||
{
|
||||
headers: {
|
||||
...form.getHeaders(),
|
||||
'accept': 'application/json',
|
||||
'Content-Type': 'multipart/form-data'
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
29
test/fixtures/node-axios/post_with_quotes_anywhere.js
generated
vendored
29
test/fixtures/node-axios/post_with_quotes_anywhere.js
generated
vendored
@@ -1,15 +1,18 @@
|
||||
const axios = require('axios');
|
||||
|
||||
const response = await axios.post('https://localhost:28139', {
|
||||
headers: {
|
||||
'A': '\'\'a\'',
|
||||
'B': '"',
|
||||
'Cookie': 'x=1\'; y=2"',
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
auth: {
|
||||
username: 'ol\'',
|
||||
password: 'asd"'
|
||||
},
|
||||
data: 'a=b&c="&d=\''
|
||||
});
|
||||
const response = await axios.post(
|
||||
'https://localhost:28139',
|
||||
'a=b&c="&d=\'',
|
||||
{
|
||||
headers: {
|
||||
'A': '\'\'a\'',
|
||||
'B': '"',
|
||||
'Cookie': 'x=1\'; y=2"',
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
auth: {
|
||||
username: 'ol\'',
|
||||
password: 'asd"'
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
15
test/fixtures/node-axios/post_with_single_quotes_inside_double_quotes.js
generated
vendored
15
test/fixtures/node-axios/post_with_single_quotes_inside_double_quotes.js
generated
vendored
@@ -1,8 +1,11 @@
|
||||
const axios = require('axios');
|
||||
|
||||
const response = await axios.post('http://localhost:28139/', {
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
data: 'foo=\'bar\''
|
||||
});
|
||||
const response = await axios.post(
|
||||
'http://localhost:28139/',
|
||||
'foo=\'bar\'',
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
31
test/fixtures/node-axios/post_with_urlencoded_data.js
generated
vendored
31
test/fixtures/node-axios/post_with_urlencoded_data.js
generated
vendored
@@ -1,19 +1,22 @@
|
||||
const axios = require('axios');
|
||||
|
||||
const response = await axios.post('http://localhost:28139/echo/html/', {
|
||||
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'
|
||||
},
|
||||
data: {
|
||||
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'
|
||||
}
|
||||
}
|
||||
});
|
||||
);
|
||||
|
||||
29
test/fixtures/node-axios/post_with_urlencoded_data_and_headers.js
generated
vendored
29
test/fixtures/node-axios/post_with_urlencoded_data_and_headers.js
generated
vendored
@@ -1,17 +1,8 @@
|
||||
const axios = require('axios');
|
||||
|
||||
const response = await axios.post('http://localhost:28139/api/Listing.svc/PropertySearch_Post', {
|
||||
headers: {
|
||||
'Origin': 'http://www.realtor.ca',
|
||||
'Accept-Encoding': 'gzip, deflate',
|
||||
'Accept-Language': 'en-US,en;q=0.8',
|
||||
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',
|
||||
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
||||
'Accept': '*/*',
|
||||
'Referer': 'http://www.realtor.ca/Residential/Map.aspx',
|
||||
'Connection': 'keep-alive'
|
||||
},
|
||||
data: {
|
||||
const response = await axios.post(
|
||||
'http://localhost:28139/api/Listing.svc/PropertySearch_Post',
|
||||
new URLSearchParams({
|
||||
'CultureId': '1',
|
||||
'ApplicationId': '1',
|
||||
'RecordsPerPage': '200',
|
||||
@@ -33,5 +24,17 @@ const response = await axios.post('http://localhost:28139/api/Listing.svc/Proper
|
||||
'Latitude': '43.6552047278685',
|
||||
'ZoomLevel': '13',
|
||||
'CurrentPage': '1'
|
||||
}),
|
||||
{
|
||||
headers: {
|
||||
'Origin': 'http://www.realtor.ca',
|
||||
'Accept-Encoding': 'gzip, deflate',
|
||||
'Accept-Language': 'en-US,en;q=0.8',
|
||||
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',
|
||||
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
||||
'Accept': '*/*',
|
||||
'Referer': 'http://www.realtor.ca/Residential/Map.aspx',
|
||||
'Connection': 'keep-alive'
|
||||
}
|
||||
}
|
||||
});
|
||||
);
|
||||
|
||||
15
test/fixtures/node-axios/post_xpost.js
generated
vendored
15
test/fixtures/node-axios/post_xpost.js
generated
vendored
@@ -1,8 +1,11 @@
|
||||
const axios = require('axios');
|
||||
|
||||
const response = await axios.post('http://localhost:28139/api/xxxxxxxxxxxxxxxx', {
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
data: '{"keywords":"php","page":1,"searchMode":1}'
|
||||
});
|
||||
const response = await axios.post(
|
||||
'http://localhost:28139/api/xxxxxxxxxxxxxxxx',
|
||||
'{"keywords":"php","page":1,"searchMode":1}',
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
23
test/fixtures/node-axios/put_basic_auth_json_data.js
generated
vendored
23
test/fixtures/node-axios/put_basic_auth_json_data.js
generated
vendored
@@ -1,12 +1,15 @@
|
||||
const axios = require('axios');
|
||||
|
||||
const response = await axios.put('http://localhost:28139/test/_security', {
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
auth: {
|
||||
username: 'admin',
|
||||
password: '123'
|
||||
},
|
||||
data: '{"admins":{"names":[], "roles":[]}, "readers":{"names":["joe"],"roles":[]}}'
|
||||
});
|
||||
const response = await axios.put(
|
||||
'http://localhost:28139/test/_security',
|
||||
'{"admins":{"names":[], "roles":[]}, "readers":{"names":["joe"],"roles":[]}}',
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
auth: {
|
||||
username: 'admin',
|
||||
password: '123'
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
19
test/fixtures/node-axios/put_with_T_option.js
generated
vendored
19
test/fixtures/node-axios/put_with_T_option.js
generated
vendored
@@ -1,15 +1,18 @@
|
||||
const axios = require('axios');
|
||||
|
||||
const response = await axios.put('http://localhost:28139/twitter/_mapping/user?pretty', {
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
// data: '{"properties": {"email": {"type": "keyword"}}}',
|
||||
data: JSON.stringify({
|
||||
const response = await axios.put(
|
||||
'http://localhost:28139/twitter/_mapping/user?pretty',
|
||||
// '{"properties": {"email": {"type": "keyword"}}}',
|
||||
{
|
||||
'properties': {
|
||||
'email': {
|
||||
'type': 'keyword'
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
15
test/fixtures/node-axios/put_with_file.js
generated
vendored
15
test/fixtures/node-axios/put_with_file.js
generated
vendored
@@ -1,8 +1,11 @@
|
||||
const axios = require('axios');
|
||||
|
||||
const response = await axios.put('http://localhost:28139/upload', {
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
data: '@new_file'
|
||||
});
|
||||
const response = await axios.put(
|
||||
'http://localhost:28139/upload',
|
||||
'@new_file',
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
19
test/fixtures/node-axios/put_xput.js
generated
vendored
19
test/fixtures/node-axios/put_xput.js
generated
vendored
@@ -1,15 +1,18 @@
|
||||
const axios = require('axios');
|
||||
|
||||
const response = await axios.put('http://localhost:28139/twitter/_mapping/user?pretty', {
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
// data: '{"properties": {"email": {"type": "keyword"}}}',
|
||||
data: JSON.stringify({
|
||||
const response = await axios.put(
|
||||
'http://localhost:28139/twitter/_mapping/user?pretty',
|
||||
// '{"properties": {"email": {"type": "keyword"}}}',
|
||||
{
|
||||
'properties': {
|
||||
'email': {
|
||||
'type': 'keyword'
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
4
test/fixtures/node-axios/strange_http_method.js
generated
vendored
4
test/fixtures/node-axios/strange_http_method.js
generated
vendored
@@ -1,5 +1,3 @@
|
||||
const axios = require('axios');
|
||||
|
||||
const response = await axios.request('localhost:28139', {
|
||||
method: 'what'
|
||||
});
|
||||
const response = await axios('localhost:28139');
|
||||
|
||||
Reference in New Issue
Block a user