mirror of
https://github.com/curlconverter/curlconverter.git
synced 2022-05-22 02:35:29 +03:00
applied standard styles, moved test.js to root dir
This commit is contained in:
@@ -1 +0,0 @@
|
||||
curl 'http://en.wikipedia.org/' -H 'Accept-Encoding: gzip, deflate, sdch' -H 'Accept-Language: en-US,en;q=0.8' -H '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' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Referer: http://www.wikipedia.org/' -H 'Cookie: GeoIP=US:Albuquerque:35.1241:-106.7675:v4; uls-previous-languages=%5B%22en%22%5D; mediaWiki.user.sessionId=VaHaeVW3m0ymvx9kacwshZIDkv8zgF9y; centralnotice_buckets_by_campaign=%7B%22C14_enUS_dsk_lw_FR%22%3A%7B%22val%22%3A%220%22%2C%22start%22%3A1412172000%2C%22end%22%3A1422576000%7D%2C%22C14_en5C_dec_dsk_FR%22%3A%7B%22val%22%3A3%2C%22start%22%3A1417514400%2C%22end%22%3A1425290400%7D%2C%22C14_en5C_bkup_dsk_FR%22%3A%7B%22val%22%3A1%2C%22start%22%3A1417428000%2C%22end%22%3A1425290400%7D%7D; centralnotice_bannercount_fr12=22; centralnotice_bannercount_fr12-wait=14' -H 'Connection: keep-alive' --compressed
|
||||
@@ -1 +0,0 @@
|
||||
curl -X POST http://example.com/ --data "foo='bar'"
|
||||
@@ -1 +0,0 @@
|
||||
curl -X POST http://example.com/ --data "foo=\"bar\""
|
||||
@@ -1 +0,0 @@
|
||||
curl -X POST http://example.com/ --data 'foo=\"bar\"'
|
||||
@@ -1 +0,0 @@
|
||||
curl -X POST http://example.com/ --data "foo=\'bar\'"
|
||||
@@ -1 +0,0 @@
|
||||
curl -L http://www.google.com
|
||||
@@ -1 +0,0 @@
|
||||
curl -H "Host: api.ipify.org" -H "Accept: */*" -H "User-Agent: GiftTalk/2.7.2 (iPhone; iOS 9.0.2; Scale/3.00)" -H "Accept-Language: en-CN;q=1, zh-Hans-CN;q=0.9" --compressed http://api.ipify.org/?format=json&
|
||||
@@ -1,4 +0,0 @@
|
||||
curl -X GET 'http://fiddle.jshell.net/echo/html/'\
|
||||
-H 'Origin: http://fiddle.jshell.net'\
|
||||
-d msg1="value1"\
|
||||
-d msg2="value2"
|
||||
@@ -1 +0,0 @@
|
||||
curl -i -X PUT --data "@new_file" http://awesomeurl.com/upload
|
||||
@@ -1 +0,0 @@
|
||||
curl google.com --data 'field=don%27t%20you%20like%20quotes'
|
||||
@@ -1 +0,0 @@
|
||||
curl 'http://www.w3schools.com/ajax/demo_post.asp' -X POST -H 'Origin: http://www.w3schools.com' -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: en-US,en;q=0.8' -H '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' -H 'Accept: */*' -H 'Referer: http://www.w3schools.com/ajax/tryit_view.asp?x=0.07944501144811511' -H 'Cookie: _gat=1; ASPSESSIONIDACCRDTDC=MCMDKFMBLLLHGKCGNMKNGPKI; _ga=GA1.2.1424920226.1419478126' -H 'Connection: keep-alive' -H 'Content-Length: 0' --compressed
|
||||
@@ -1 +0,0 @@
|
||||
curl -k -X GET https://example.com
|
||||
@@ -1 +0,0 @@
|
||||
curl --insecure -X GET https://example.com
|
||||
@@ -1 +0,0 @@
|
||||
curl 'http://fiddle.jshell.net/echo/html/' -H 'Origin: http://fiddle.jshell.net' -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: en-US,en;q=0.8' -H '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' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'Accept: */*' -H 'Referer: http://fiddle.jshell.net/_display/' -H 'X-Requested-With: XMLHttpRequest' -H 'Connection: keep-alive' --data 'msg1=wow&msg2=such' --compressed
|
||||
@@ -1 +0,0 @@
|
||||
curl http://indeed.com
|
||||
@@ -1 +0,0 @@
|
||||
curl -i -X POST http://1.2.3.4/endpoint -H "Content-Type:application/json" -H 'key:abcdefg'
|
||||
@@ -1 +0,0 @@
|
||||
curl 'http://www.realtor.ca/api/Listing.svc/PropertySearch_Post' -H 'Origin: http://www.realtor.ca' -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: en-US,en;q=0.8' -H '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' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'Accept: */*' -H 'Referer: http://www.realtor.ca/Residential/Map.aspx' -H 'Connection: keep-alive' --data 'CultureId=1&ApplicationId=1&RecordsPerPage=200&MaximumResults=200&PropertyTypeId=300&TransactionTypeId=2&StoreyRange=0-0&BuildingTypeId=1&BedRange=0-0&BathRange=0-0&LongitudeMin=-79.3676805496215&LongitudeMax=-79.27300930023185&LatitudeMin=43.660358732823845&LatitudeMax=43.692390574029936&SortOrder=A&SortBy=1&viewState=m&Longitude=-79.4107246398925&Latitude=43.6552047278685&ZoomLevel=13&CurrentPage=1'
|
||||
@@ -1 +0,0 @@
|
||||
curl 'http://example.com/post' --data-binary '{"title":"china1"}'
|
||||
@@ -1 +0,0 @@
|
||||
curl http://example.com/ -H 'foo: bar'
|
||||
@@ -1 +0,0 @@
|
||||
curl -X POST http://example.com/ --data 'foo="bar"'
|
||||
@@ -1,24 +0,0 @@
|
||||
var request = require('request');
|
||||
|
||||
var headers = {
|
||||
'Accept-Encoding': 'gzip, deflate, sdch',
|
||||
'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': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
|
||||
'Referer': 'http://www.wikipedia.org/',
|
||||
'Connection': 'keep-alive',
|
||||
'Cookie': 'GeoIP=US:Albuquerque:35.1241:-106.7675:v4; uls-previous-languages=%5B%22en%22%5D; mediaWiki.user.sessionId=VaHaeVW3m0ymvx9kacwshZIDkv8zgF9y; centralnotice_buckets_by_campaign=%7B%22C14_enUS_dsk_lw_FR%22%3A%7B%22val%22%3A%220%22%2C%22start%22%3A1412172000%2C%22end%22%3A1422576000%7D%2C%22C14_en5C_dec_dsk_FR%22%3A%7B%22val%22%3A3%2C%22start%22%3A1417514400%2C%22end%22%3A1425290400%7D%2C%22C14_en5C_bkup_dsk_FR%22%3A%7B%22val%22%3A1%2C%22start%22%3A1417428000%2C%22end%22%3A1425290400%7D%7D; centralnotice_bannercount_fr12=22; centralnotice_bannercount_fr12-wait=14'
|
||||
};
|
||||
|
||||
var options = {
|
||||
url: 'http://en.wikipedia.org/',
|
||||
headers: headers
|
||||
};
|
||||
|
||||
function callback(error, response, body) {
|
||||
if (!error && response.statusCode == 200) {
|
||||
console.log(body);
|
||||
}
|
||||
}
|
||||
|
||||
request(options, callback);
|
||||
@@ -1,17 +0,0 @@
|
||||
var request = require('request');
|
||||
|
||||
var dataString = 'foo=\'bar\'';
|
||||
|
||||
var options = {
|
||||
url: 'http://example.com/',
|
||||
method: 'POST',
|
||||
body: dataString
|
||||
};
|
||||
|
||||
function callback(error, response, body) {
|
||||
if (!error && response.statusCode == 200) {
|
||||
console.log(body);
|
||||
}
|
||||
}
|
||||
|
||||
request(options, callback);
|
||||
@@ -1,17 +0,0 @@
|
||||
var request = require('request');
|
||||
|
||||
var dataString = 'foo="bar"';
|
||||
|
||||
var options = {
|
||||
url: 'http://example.com/',
|
||||
method: 'POST',
|
||||
body: dataString
|
||||
};
|
||||
|
||||
function callback(error, response, body) {
|
||||
if (!error && response.statusCode == 200) {
|
||||
console.log(body);
|
||||
}
|
||||
}
|
||||
|
||||
request(options, callback);
|
||||
@@ -1,17 +0,0 @@
|
||||
var request = require('request');
|
||||
|
||||
var dataString = 'foo=\"bar\"';
|
||||
|
||||
var options = {
|
||||
url: 'http://example.com/',
|
||||
method: 'POST',
|
||||
body: dataString
|
||||
};
|
||||
|
||||
function callback(error, response, body) {
|
||||
if (!error && response.statusCode == 200) {
|
||||
console.log(body);
|
||||
}
|
||||
}
|
||||
|
||||
request(options, callback);
|
||||
@@ -1,17 +0,0 @@
|
||||
var request = require('request');
|
||||
|
||||
var dataString = 'foo=\\\'bar\\\'';
|
||||
|
||||
var options = {
|
||||
url: 'http://example.com/',
|
||||
method: 'POST',
|
||||
body: dataString
|
||||
};
|
||||
|
||||
function callback(error, response, body) {
|
||||
if (!error && response.statusCode == 200) {
|
||||
console.log(body);
|
||||
}
|
||||
}
|
||||
|
||||
request(options, callback);
|
||||
@@ -1,13 +0,0 @@
|
||||
var request = require('request');
|
||||
|
||||
var options = {
|
||||
url: 'http://www.google.com'
|
||||
};
|
||||
|
||||
function callback(error, response, body) {
|
||||
if (!error && response.statusCode == 200) {
|
||||
console.log(body);
|
||||
}
|
||||
}
|
||||
|
||||
request(options, callback);
|
||||
@@ -1,27 +0,0 @@
|
||||
var request = require('request');
|
||||
|
||||
var 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',
|
||||
'Connection': 'keep-alive',
|
||||
'Content-Length': '0',
|
||||
'Cookie': '_gat=1; ASPSESSIONIDACCRDTDC=MCMDKFMBLLLHGKCGNMKNGPKI; _ga=GA1.2.1424920226.1419478126'
|
||||
};
|
||||
|
||||
var options = {
|
||||
url: 'http://www.w3schools.com/ajax/demo_post.asp',
|
||||
method: 'POST',
|
||||
headers: headers
|
||||
};
|
||||
|
||||
function callback(error, response, body) {
|
||||
if (!error && response.statusCode == 200) {
|
||||
console.log(body);
|
||||
}
|
||||
}
|
||||
|
||||
request(options, callback);
|
||||
@@ -1,30 +0,0 @@
|
||||
var request = require('request');
|
||||
|
||||
var 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'
|
||||
};
|
||||
|
||||
var dataString = 'msg1=wow&msg2=such';
|
||||
|
||||
var options = {
|
||||
url: 'http://fiddle.jshell.net/echo/html/',
|
||||
method: 'POST',
|
||||
headers: headers,
|
||||
body: dataString
|
||||
};
|
||||
|
||||
function callback(error, response, body) {
|
||||
if (!error && response.statusCode == 200) {
|
||||
console.log(body);
|
||||
}
|
||||
}
|
||||
|
||||
request(options, callback);
|
||||
@@ -1,13 +0,0 @@
|
||||
var request = require('request');
|
||||
|
||||
var options = {
|
||||
url: 'http://indeed.com'
|
||||
};
|
||||
|
||||
function callback(error, response, body) {
|
||||
if (!error && response.statusCode == 200) {
|
||||
console.log(body);
|
||||
}
|
||||
}
|
||||
|
||||
request(options, callback);
|
||||
@@ -1,29 +0,0 @@
|
||||
var request = require('request');
|
||||
|
||||
var 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'
|
||||
};
|
||||
|
||||
var dataString = 'CultureId=1&ApplicationId=1&RecordsPerPage=200&MaximumResults=200&PropertyTypeId=300&TransactionTypeId=2&StoreyRange=0-0&BuildingTypeId=1&BedRange=0-0&BathRange=0-0&LongitudeMin=-79.3676805496215&LongitudeMax=-79.27300930023185&LatitudeMin=43.660358732823845&LatitudeMax=43.692390574029936&SortOrder=A&SortBy=1&viewState=m&Longitude=-79.4107246398925&Latitude=43.6552047278685&ZoomLevel=13&CurrentPage=1';
|
||||
|
||||
var options = {
|
||||
url: 'http://www.realtor.ca/api/Listing.svc/PropertySearch_Post',
|
||||
method: 'POST',
|
||||
headers: headers,
|
||||
body: dataString
|
||||
};
|
||||
|
||||
function callback(error, response, body) {
|
||||
if (!error && response.statusCode == 200) {
|
||||
console.log(body);
|
||||
}
|
||||
}
|
||||
|
||||
request(options, callback);
|
||||
@@ -1,17 +0,0 @@
|
||||
var request = require('request');
|
||||
|
||||
var dataString = '{"title":"china1"}';
|
||||
|
||||
var options = {
|
||||
url: 'http://example.com/post',
|
||||
method: 'POST',
|
||||
body: dataString
|
||||
};
|
||||
|
||||
function callback(error, response, body) {
|
||||
if (!error && response.statusCode == 200) {
|
||||
console.log(body);
|
||||
}
|
||||
}
|
||||
|
||||
request(options, callback);
|
||||
@@ -1,18 +0,0 @@
|
||||
var request = require('request');
|
||||
|
||||
var headers = {
|
||||
'foo': 'bar'
|
||||
};
|
||||
|
||||
var options = {
|
||||
url: 'http://example.com/',
|
||||
headers: headers
|
||||
};
|
||||
|
||||
function callback(error, response, body) {
|
||||
if (!error && response.statusCode == 200) {
|
||||
console.log(body);
|
||||
}
|
||||
}
|
||||
|
||||
request(options, callback);
|
||||
@@ -1,17 +0,0 @@
|
||||
var request = require('request');
|
||||
|
||||
var dataString = 'foo="bar"';
|
||||
|
||||
var options = {
|
||||
url: 'http://example.com/',
|
||||
method: 'POST',
|
||||
body: dataString
|
||||
};
|
||||
|
||||
function callback(error, response, body) {
|
||||
if (!error && response.statusCode == 200) {
|
||||
console.log(body);
|
||||
}
|
||||
}
|
||||
|
||||
request(options, callback);
|
||||
@@ -1,16 +0,0 @@
|
||||
module.exports = { url: 'http://en.wikipedia.org/',
|
||||
headers:
|
||||
{ 'Accept-Encoding': 'gzip, deflate, sdch',
|
||||
'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: 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
|
||||
Referer: 'http://www.wikipedia.org/',
|
||||
Connection: 'keep-alive' },
|
||||
cookies:
|
||||
{ GeoIP: 'US:Albuquerque:35.1241:-106.7675:v4',
|
||||
'uls-previous-languages': '%5B%22en%22%5D',
|
||||
'mediaWiki.user.sessionId': 'VaHaeVW3m0ymvx9kacwshZIDkv8zgF9y',
|
||||
centralnotice_buckets_by_campaign: '%7B%22C14_enUS_dsk_lw_FR%22%3A%7B%22val%22%3A%220%22%2C%22start%22%3A1412172000%2C%22end%22%3A1422576000%7D%2C%22C14_en5C_dec_dsk_FR%22%3A%7B%22val%22%3A3%2C%22start%22%3A1417514400%2C%22end%22%3A1425290400%7D%2C%22C14_en5C_bkup_dsk_FR%22%3A%7B%22val%22%3A1%2C%22start%22%3A1417428000%2C%22end%22%3A1425290400%7D%7D',
|
||||
centralnotice_bannercount_fr12: '22',
|
||||
'centralnotice_bannercount_fr12-wait': '14' },
|
||||
method: 'get' };
|
||||
@@ -1,15 +0,0 @@
|
||||
module.exports = { url: 'http://www.w3schools.com/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',
|
||||
Connection: 'keep-alive',
|
||||
'Content-Length': '0' },
|
||||
cookies:
|
||||
{ _gat: '1',
|
||||
ASPSESSIONIDACCRDTDC: 'MCMDKFMBLLLHGKCGNMKNGPKI',
|
||||
_ga: 'GA1.2.1424920226.1419478126' },
|
||||
method: 'post' };
|
||||
@@ -1,16 +0,0 @@
|
||||
module.exports = {
|
||||
url: 'http://fiddle.jshell.net/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'
|
||||
},
|
||||
method: 'post',
|
||||
data: 'msg1=wow&msg2=such'
|
||||
};
|
||||
@@ -1,8 +0,0 @@
|
||||
module.exports = {
|
||||
url: 'http://fiddle.jshell.net/echo/html/',
|
||||
headers: {
|
||||
Origin: 'http://fiddle.jshell.net'
|
||||
},
|
||||
method: 'post',
|
||||
data: 'msg1=value1&msg2=value2'
|
||||
};
|
||||
@@ -1,14 +0,0 @@
|
||||
<?php
|
||||
include('vendor/rmccue/requests/library/Requests.php');
|
||||
Requests::register_autoloader();
|
||||
$headers = array(
|
||||
'Accept-Encoding' => 'gzip, deflate, sdch',
|
||||
'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' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
|
||||
'Referer' => 'http://www.wikipedia.org/',
|
||||
'Connection' => 'keep-alive',
|
||||
'Cookie' => 'GeoIP=US:Albuquerque:35.1241:-106.7675:v4; uls-previous-languages=%5B%22en%22%5D; mediaWiki.user.sessionId=VaHaeVW3m0ymvx9kacwshZIDkv8zgF9y; centralnotice_buckets_by_campaign=%7B%22C14_enUS_dsk_lw_FR%22%3A%7B%22val%22%3A%220%22%2C%22start%22%3A1412172000%2C%22end%22%3A1422576000%7D%2C%22C14_en5C_dec_dsk_FR%22%3A%7B%22val%22%3A3%2C%22start%22%3A1417514400%2C%22end%22%3A1425290400%7D%2C%22C14_en5C_bkup_dsk_FR%22%3A%7B%22val%22%3A1%2C%22start%22%3A1417428000%2C%22end%22%3A1425290400%7D%7D; centralnotice_bannercount_fr12=22; centralnotice_bannercount_fr12-wait=14'
|
||||
);
|
||||
$data = array();
|
||||
$response = Requests::get('http://en.wikipedia.org/', $headers, $data);
|
||||
@@ -1,7 +0,0 @@
|
||||
<?php
|
||||
include('vendor/rmccue/requests/library/Requests.php');
|
||||
Requests::register_autoloader();
|
||||
$data = array(
|
||||
'field' => 'don\'t you like quotes'
|
||||
);
|
||||
$response = Requests::post('google.com', $headers, $data);
|
||||
@@ -1,16 +0,0 @@
|
||||
<?php
|
||||
include('vendor/rmccue/requests/library/Requests.php');
|
||||
Requests::register_autoloader();
|
||||
$headers = array(
|
||||
'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',
|
||||
'Connection' => 'keep-alive',
|
||||
'Content-Length' => '0',
|
||||
'Cookie' => '_gat=1; ASPSESSIONIDACCRDTDC=MCMDKFMBLLLHGKCGNMKNGPKI; _ga=GA1.2.1424920226.1419478126'
|
||||
);
|
||||
$data = array();
|
||||
$response = Requests::post('http://www.w3schools.com/ajax/demo_post.asp', $headers, $data);
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
include('vendor/rmccue/requests/library/Requests.php');
|
||||
Requests::register_autoloader();
|
||||
$headers = array(
|
||||
'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 = array(
|
||||
'msg1' => 'wow',
|
||||
'msg2' => 'such'
|
||||
);
|
||||
$response = Requests::post('http://fiddle.jshell.net/echo/html/', $headers, $data);
|
||||
@@ -1,19 +0,0 @@
|
||||
cookies = {
|
||||
'GeoIP': 'US:Albuquerque:35.1241:-106.7675:v4',
|
||||
'uls-previous-languages': '%5B%22en%22%5D',
|
||||
'mediaWiki.user.sessionId': 'VaHaeVW3m0ymvx9kacwshZIDkv8zgF9y',
|
||||
'centralnotice_buckets_by_campaign': '%7B%22C14_enUS_dsk_lw_FR%22%3A%7B%22val%22%3A%220%22%2C%22start%22%3A1412172000%2C%22end%22%3A1422576000%7D%2C%22C14_en5C_dec_dsk_FR%22%3A%7B%22val%22%3A3%2C%22start%22%3A1417514400%2C%22end%22%3A1425290400%7D%2C%22C14_en5C_bkup_dsk_FR%22%3A%7B%22val%22%3A1%2C%22start%22%3A1417428000%2C%22end%22%3A1425290400%7D%7D',
|
||||
'centralnotice_bannercount_fr12': '22',
|
||||
'centralnotice_bannercount_fr12-wait': '14',
|
||||
}
|
||||
|
||||
headers = {
|
||||
'Accept-Encoding': 'gzip, deflate, sdch',
|
||||
'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': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
|
||||
'Referer': 'http://www.wikipedia.org/',
|
||||
'Connection': 'keep-alive',
|
||||
}
|
||||
|
||||
requests.get('http://en.wikipedia.org/', headers=headers, cookies=cookies)
|
||||
@@ -1 +0,0 @@
|
||||
requests.get('https://example.com', verify=False)
|
||||
@@ -1,18 +0,0 @@
|
||||
cookies = {
|
||||
'_gat': '1',
|
||||
'ASPSESSIONIDACCRDTDC': 'MCMDKFMBLLLHGKCGNMKNGPKI',
|
||||
'_ga': 'GA1.2.1424920226.1419478126',
|
||||
}
|
||||
|
||||
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',
|
||||
'Connection': 'keep-alive',
|
||||
'Content-Length': '0',
|
||||
}
|
||||
|
||||
requests.post('http://www.w3schools.com/ajax/demo_post.asp', headers=headers, cookies=cookies)
|
||||
@@ -1,15 +0,0 @@
|
||||
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 = 'msg1=wow&msg2=such'
|
||||
|
||||
requests.post('http://fiddle.jshell.net/echo/html/', headers=headers, data=data)
|
||||
@@ -1 +0,0 @@
|
||||
requests.get('http://indeed.com')
|
||||
@@ -1,6 +0,0 @@
|
||||
headers = {
|
||||
'Content-Type': 'application/json',
|
||||
'key': 'abcdefg',
|
||||
}
|
||||
|
||||
requests.post('http://1.2.3.4/endpoint', headers=headers)
|
||||
@@ -1,14 +0,0 @@
|
||||
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 = 'CultureId=1&ApplicationId=1&RecordsPerPage=200&MaximumResults=200&PropertyTypeId=300&TransactionTypeId=2&StoreyRange=0-0&BuildingTypeId=1&BedRange=0-0&BathRange=0-0&LongitudeMin=-79.3676805496215&LongitudeMax=-79.27300930023185&LatitudeMin=43.660358732823845&LatitudeMax=43.692390574029936&SortOrder=A&SortBy=1&viewState=m&Longitude=-79.4107246398925&Latitude=43.6552047278685&ZoomLevel=13&CurrentPage=1'
|
||||
|
||||
requests.post('http://www.realtor.ca/api/Listing.svc/PropertySearch_Post', headers=headers, data=data)
|
||||
@@ -1,3 +0,0 @@
|
||||
data = '{"title":"china1"}'
|
||||
|
||||
requests.post('http://example.com/post', data=data)
|
||||
@@ -1,8 +0,0 @@
|
||||
headers = {
|
||||
'Host': 'api.ipify.org',
|
||||
'Accept': '*/*',
|
||||
'User-Agent': 'GiftTalk/2.7.2 (iPhone; iOS 9.0.2; Scale/3.00)',
|
||||
'Accept-Language': 'en-CN;q=1, zh-Hans-CN;q=0.9',
|
||||
}
|
||||
|
||||
requests.get('http://api.ipify.org/?format=json&', headers=headers)
|
||||
@@ -1,2 +0,0 @@
|
||||
data = open('new_file')
|
||||
requests.put('http://awesomeurl.com/upload', data=data)
|
||||
266
test/test.js
266
test/test.js
@@ -1,266 +0,0 @@
|
||||
'use strict';
|
||||
var test = require('tape');
|
||||
var fs = require('fs');
|
||||
var utils = require('../util');
|
||||
|
||||
var curlconverter = require('../');
|
||||
|
||||
test('http get - parser', function (t) {
|
||||
var curlHttpGetCommand = fs.readFileSync(__dirname + '/curl1.txt', 'utf-8');
|
||||
var parsedCommand = utils.parseCurlCommand(curlHttpGetCommand);
|
||||
var goodParserOutput = require('./parser_output1.js');
|
||||
t.deepEquals(parsedCommand, goodParserOutput);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('http post - parser', function (t) {
|
||||
var curlHttpGetCommand = fs.readFileSync(__dirname + '/curl2.txt', 'utf-8');
|
||||
var parsedCommand = utils.parseCurlCommand(curlHttpGetCommand);
|
||||
var goodParserOutput = require('./parser_output2.js');
|
||||
t.deepEquals(parsedCommand, goodParserOutput);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('http post with data - parser', function (t) {
|
||||
var curlHttpGetCommand = fs.readFileSync(__dirname + '/curl3.txt', 'utf-8');
|
||||
var parsedCommand = utils.parseCurlCommand(curlHttpGetCommand);
|
||||
var goodParserOutput = require('./parser_output3.js');
|
||||
t.deepEquals(parsedCommand, goodParserOutput);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('http get - python', function (t) {
|
||||
var curlHttpGetCommand = fs.readFileSync(__dirname + '/curl1.txt', 'utf-8');
|
||||
var pythonCode = curlconverter.toPython(curlHttpGetCommand);
|
||||
var goodPythonCode = fs.readFileSync(__dirname + '/python_output1.py', 'utf-8');
|
||||
t.equal(pythonCode, goodPythonCode);
|
||||
t.end();
|
||||
});
|
||||
|
||||
|
||||
test('http post - python', function (t) {
|
||||
var curlHttpGetCommand = fs.readFileSync(__dirname + '/curl2.txt', 'utf-8');
|
||||
var pythonCode = curlconverter.toPython(curlHttpGetCommand);
|
||||
var goodPythonCode = fs.readFileSync(__dirname + '/python_output2.py', 'utf-8');
|
||||
t.equal(pythonCode, goodPythonCode);
|
||||
t.end();
|
||||
});
|
||||
|
||||
|
||||
test('http post with data - python', function (t) {
|
||||
var curlHttpGetCommand = fs.readFileSync(__dirname + '/curl3.txt', 'utf-8');
|
||||
var pythonCode = curlconverter.toPython(curlHttpGetCommand);
|
||||
var goodPythonCode = fs.readFileSync(__dirname + '/python_output3.py', 'utf-8');
|
||||
t.equal(pythonCode, goodPythonCode);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('basic http get with no headers - python', function (t) {
|
||||
var curlHttpGetCommand = fs.readFileSync(__dirname + '/curl4.txt', 'utf-8');
|
||||
var nodeCode = curlconverter.toPython(curlHttpGetCommand);
|
||||
var goodNodeCode = fs.readFileSync(__dirname + '/python_output4.py', 'utf-8');
|
||||
t.equal(nodeCode, goodNodeCode);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('http get - node', function (t) {
|
||||
var curlHttpGetCommand = fs.readFileSync(__dirname + '/curl1.txt', 'utf-8');
|
||||
var nodeCode = curlconverter.toNode(curlHttpGetCommand);
|
||||
var goodNodeCode = fs.readFileSync(__dirname + '/node_output1.js', 'utf-8');
|
||||
t.equal(nodeCode, goodNodeCode);
|
||||
t.end();
|
||||
});
|
||||
|
||||
|
||||
test('http post - node', function (t) {
|
||||
var curlHttpGetCommand = fs.readFileSync(__dirname + '/curl2.txt', 'utf-8');
|
||||
var nodeCode = curlconverter.toNode(curlHttpGetCommand);
|
||||
var goodNodeCode = fs.readFileSync(__dirname + '/node_output2.js', 'utf-8');
|
||||
t.equal(nodeCode, goodNodeCode);
|
||||
t.end();
|
||||
});
|
||||
|
||||
|
||||
test('http post with data - node', function (t) {
|
||||
var curlHttpGetCommand = fs.readFileSync(__dirname + '/curl3.txt', 'utf-8');
|
||||
var nodeCode = curlconverter.toNode(curlHttpGetCommand);
|
||||
var goodNodeCode = fs.readFileSync(__dirname + '/node_output3.js', 'utf-8').replace(/\n$/, '');
|
||||
t.equal(nodeCode, goodNodeCode);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('http post with data and headers - node', function (t) {
|
||||
var curlHttpGetCommand = fs.readFileSync(__dirname + '/curl6.txt', 'utf-8');
|
||||
var nodeCode = curlconverter.toNode(curlHttpGetCommand);
|
||||
var goodNodeCode = fs.readFileSync(__dirname + '/node_output5.js', 'utf-8').replace(/\n$/, '');
|
||||
t.equal(nodeCode, goodNodeCode);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('http post with data and headers - python', function (t) {
|
||||
var curlHttpGetCommand = fs.readFileSync(__dirname + '/curl6.txt', 'utf-8');
|
||||
var pythonCode = curlconverter.toPython(curlHttpGetCommand);
|
||||
var goodPythonCode = fs.readFileSync(__dirname + '/python_output6.py', 'utf-8').trim();
|
||||
t.equal(pythonCode, goodPythonCode);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('basic http get with no headers - node', function (t) {
|
||||
var curlHttpGetCommand = fs.readFileSync(__dirname + '/curl4.txt', 'utf-8');
|
||||
var nodeCode = curlconverter.toNode(curlHttpGetCommand);
|
||||
var goodNodeCode = fs.readFileSync(__dirname + '/node_output4.js', 'utf-8').replace(/\n$/, '');
|
||||
t.equal(nodeCode, goodNodeCode);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('basic http get with no headers - python', function (t) {
|
||||
var curlHttpGetCommand = fs.readFileSync(__dirname + '/curl5.txt', 'utf-8');
|
||||
var pythonCode = curlconverter.toPython(curlHttpGetCommand);
|
||||
var goodPythonCode = fs.readFileSync(__dirname + '/python_output5.py', 'utf-8').trim();
|
||||
t.equal(pythonCode, goodPythonCode);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('post with data-binary - node', function (t) {
|
||||
var curlHttpGetCommand = fs.readFileSync(__dirname + '/curl7.txt', 'utf-8');
|
||||
var nodeCode = curlconverter.toNode(curlHttpGetCommand);
|
||||
var goodNodeCode = fs.readFileSync(__dirname + '/node_output7.js', 'utf-8').replace(/\n$/, '');
|
||||
t.equal(nodeCode, goodNodeCode);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('post with data-binary - python', function (t) {
|
||||
var curlHttpGetCommand = fs.readFileSync(__dirname + '/curl7.txt', 'utf-8');
|
||||
var pythonCode = curlconverter.toPython(curlHttpGetCommand);
|
||||
var goodPythonCode = fs.readFileSync(__dirname + '/python_output7.py', 'utf-8').trim();
|
||||
t.equal(pythonCode, goodPythonCode);
|
||||
t.end();
|
||||
});
|
||||
|
||||
|
||||
test('http get - php', function (t) {
|
||||
var curlHttpGetCommand = fs.readFileSync(__dirname + '/curl1.txt', 'utf-8');
|
||||
var phpCode = curlconverter.toPhp(curlHttpGetCommand);
|
||||
var goodPhpCode = fs.readFileSync(__dirname + '/php_output1.php', 'utf-8');
|
||||
t.equal(phpCode, goodPhpCode);
|
||||
t.end();
|
||||
});
|
||||
|
||||
|
||||
test('http post - php', function (t) {
|
||||
var curlHttpGetCommand = fs.readFileSync(__dirname + '/curl2.txt', 'utf-8');
|
||||
var phpCode = curlconverter.toPhp(curlHttpGetCommand);
|
||||
var goodPhpCode = fs.readFileSync(__dirname + '/php_output2.php', 'utf-8');
|
||||
t.equal(phpCode, goodPhpCode);
|
||||
t.end();
|
||||
});
|
||||
|
||||
|
||||
test('http post with data - php', function (t) {
|
||||
var curlHttpPostCommand = fs.readFileSync(__dirname + '/curl3.txt', 'utf-8');
|
||||
var phpCode = curlconverter.toPhp(curlHttpPostCommand);
|
||||
var goodPhpCode = fs.readFileSync(__dirname + '/php_output3.php', 'utf-8').trim();
|
||||
t.equal(phpCode, goodPhpCode);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('http post with quotes inside data - php', function (t) {
|
||||
var curlHttpPostCommand = fs.readFileSync(__dirname + '/curl18.txt', 'utf-8');
|
||||
var phpCode = curlconverter.toPhp(curlHttpPostCommand);
|
||||
var goodPhpCode = fs.readFileSync(__dirname + '/php_output18.php', 'utf-8').trim();
|
||||
t.equal(phpCode, goodPhpCode);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('http get with single header - node', function (t) {
|
||||
var curlHttpPostCommand = fs.readFileSync(__dirname + '/curl8.txt', 'utf-8');
|
||||
var nodeCode = curlconverter.toNode(curlHttpPostCommand);
|
||||
var goodNodeCode = fs.readFileSync(__dirname + '/node_output8.js', 'utf-8').trim();
|
||||
t.equal(nodeCode, goodNodeCode);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('http post with double quotes inside single quotes body - node', function (t) {
|
||||
var curlHttpPostCommand = fs.readFileSync(__dirname + '/curl9.txt', 'utf-8');
|
||||
var nodeCode = curlconverter.toNode(curlHttpPostCommand);
|
||||
var goodNodeCode = fs.readFileSync(__dirname + '/node_output9.js', 'utf-8').trim();
|
||||
t.equal(nodeCode, goodNodeCode);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('http post with single quotes inside double quotes body - node', function (t) {
|
||||
var curlHttpPostCommand = fs.readFileSync(__dirname + '/curl10.txt', 'utf-8');
|
||||
var nodeCode = curlconverter.toNode(curlHttpPostCommand);
|
||||
var goodNodeCode = fs.readFileSync(__dirname + '/node_output10.js', 'utf-8').trim();
|
||||
t.equal(nodeCode, goodNodeCode);
|
||||
t.end();
|
||||
});
|
||||
|
||||
|
||||
test('http post with escaped double quotes inside single quotes body - node', function (t) {
|
||||
var curlHttpPostCommand = fs.readFileSync(__dirname + '/curl12.txt', 'utf-8');
|
||||
var nodeCode = curlconverter.toNode(curlHttpPostCommand);
|
||||
var goodNodeCode = fs.readFileSync(__dirname + '/node_output12.js', 'utf-8').trim();
|
||||
t.equal(nodeCode, goodNodeCode);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('http post with escaped single quotes inside double quotes body - node', function (t) {
|
||||
var curlHttpPostCommand = fs.readFileSync(__dirname + '/curl13.txt', 'utf-8');
|
||||
var nodeCode = curlconverter.toNode(curlHttpPostCommand);
|
||||
var goodNodeCode = fs.readFileSync(__dirname + '/node_output13.js', 'utf-8').trim();
|
||||
t.equal(nodeCode, goodNodeCode);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('http post with escaped double quotes inside double quotes body - node', function (t) {
|
||||
var curlHttpPostCommand = fs.readFileSync(__dirname + '/curl11.txt', 'utf-8');
|
||||
var nodeCode = curlconverter.toNode(curlHttpPostCommand);
|
||||
var goodNodeCode = fs.readFileSync(__dirname + '/node_output11.js', 'utf-8').trim();
|
||||
t.equal(nodeCode, goodNodeCode);
|
||||
t.end();
|
||||
});
|
||||
|
||||
|
||||
test('http get with -L param - node', function (t) {
|
||||
var curlHttpPostCommand = fs.readFileSync(__dirname + '/curl14.txt', 'utf-8');
|
||||
var nodeCode = curlconverter.toNode(curlHttpPostCommand);
|
||||
var goodNodeCode = fs.readFileSync(__dirname + '/node_output14.js', 'utf-8').trim();
|
||||
t.equal(nodeCode, goodNodeCode);
|
||||
t.end();
|
||||
});
|
||||
|
||||
|
||||
test('http with charles syntax - python', function (t) {
|
||||
var curlHttpGetCommand = fs.readFileSync(__dirname + '/curl15.txt', 'utf-8');
|
||||
var pythonCode = curlconverter.toPython(curlHttpGetCommand);
|
||||
var goodPythonCode = fs.readFileSync(__dirname + '/python_output8.py', 'utf-8').trim();
|
||||
t.equal(pythonCode, goodPythonCode);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('multiline http post with data - parser', function (t) {
|
||||
var curlHttpGetCommand = fs.readFileSync(__dirname + '/curl16.txt', 'utf-8');
|
||||
var parsedCommand = utils.parseCurlCommand(curlHttpGetCommand);
|
||||
var goodParserOutput = require('./parser_output4.js');
|
||||
t.deepEquals(parsedCommand, goodParserOutput);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('http put with file - python', function (t) {
|
||||
var curlHttpGetCommand = fs.readFileSync(__dirname + '/curl17.txt', 'utf-8');
|
||||
var pythonCode = curlconverter.toPython(curlHttpGetCommand);
|
||||
var goodPythonCode = fs.readFileSync(__dirname + '/python_output9.py', 'utf-8');
|
||||
t.equal(pythonCode, goodPythonCode);
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('http get with -k/--insecure - python', function (t) {
|
||||
var curlHttpGetCommand0 = fs.readFileSync(__dirname + '/curl20.txt', 'utf-8');
|
||||
var curlHttpGetCommand1 = fs.readFileSync(__dirname + '/curl21.txt', 'utf-8');
|
||||
var pythonCode0 = curlconverter.toPython(curlHttpGetCommand0);
|
||||
var pythonCode1 = curlconverter.toPython(curlHttpGetCommand1);
|
||||
var goodPythonCode = fs.readFileSync(__dirname + '/python_output10.py', 'utf-8').trim();
|
||||
t.equal(pythonCode0, pythonCode1, goodPythonCode);
|
||||
t.end();
|
||||
});
|
||||
Reference in New Issue
Block a user