mirror of
https://github.com/curlconverter/curlconverter.git
synced 2022-05-22 02:35:29 +03:00
parse headers more like curl and query more like python (#362)
* parse headers more like curl and query like python * --data sets content-type * update sample in readme * actually handle empty -H
This commit is contained in:
committed by
GitHub
parent
a532bd4158
commit
6a43531ec4
@@ -3,10 +3,12 @@
|
||||
`curlconverter` transpiles [`curl`](https://en.wikipedia.org/wiki/CURL) commands into programs in other programming languages.
|
||||
|
||||
```sh
|
||||
$ curlconverter --data "Hello, world!" example.com
|
||||
$ curlconverter --data-raw "hello=world" example.com
|
||||
import requests
|
||||
|
||||
data = 'Hello, world!'
|
||||
data = {
|
||||
'hello': 'world',
|
||||
}
|
||||
|
||||
response = requests.post('http://example.com', data=data)
|
||||
```
|
||||
|
||||
2
fixtures/ansible/post_empty.yml
generated
2
fixtures/ansible/post_empty.yml
generated
@@ -3,4 +3,6 @@
|
||||
uri:
|
||||
url: 'http://localhost:28139'
|
||||
method: POST
|
||||
headers:
|
||||
Content-Type: 'application/x-www-form-urlencoded'
|
||||
register: result
|
||||
|
||||
2
fixtures/ansible/post_number.yml
generated
2
fixtures/ansible/post_number.yml
generated
@@ -6,4 +6,6 @@
|
||||
body:
|
||||
123
|
||||
body_format: json
|
||||
headers:
|
||||
Content-Type: 'application/x-www-form-urlencoded'
|
||||
register: result
|
||||
|
||||
2
fixtures/ansible/post_with_data_raw.yml
generated
2
fixtures/ansible/post_with_data_raw.yml
generated
@@ -6,4 +6,6 @@
|
||||
body:
|
||||
"msg1=wow&msg2=such&msg3=@rawmsg"
|
||||
body_format: json
|
||||
headers:
|
||||
Content-Type: 'application/x-www-form-urlencoded'
|
||||
register: result
|
||||
|
||||
2
fixtures/ansible/post_xpost.yml
generated
2
fixtures/ansible/post_xpost.yml
generated
@@ -6,4 +6,6 @@
|
||||
body:
|
||||
{"keywords":"php","page":1,"searchMode":1}
|
||||
body_format: json
|
||||
headers:
|
||||
Content-Type: 'application/x-www-form-urlencoded'
|
||||
register: result
|
||||
|
||||
2
fixtures/ansible/put_basic_auth_json_data.yml
generated
2
fixtures/ansible/put_basic_auth_json_data.yml
generated
@@ -6,6 +6,8 @@
|
||||
body:
|
||||
{"admins":{"names":[],"roles":[]},"readers":{"names":["joe"],"roles":[]}}
|
||||
body_format: json
|
||||
headers:
|
||||
Content-Type: 'application/x-www-form-urlencoded'
|
||||
url_username: admin
|
||||
url_password: 123
|
||||
register: result
|
||||
|
||||
@@ -1 +1 @@
|
||||
curl --header "Content-Type: text/xml;charset=UTF-8" --header "getWorkOrderCancel" postman-echo.com/get
|
||||
curl --header "Content-Type: text/xml;charset=UTF-8" --header "getWorkOrderCancel;" postman-echo.com/get
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
void main() async {
|
||||
var headers = {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
};
|
||||
|
||||
var data = 'foo=\"bar\"';
|
||||
|
||||
var url = Uri.parse('http://example.com/');
|
||||
var res = await http.post(url, body: data);
|
||||
var res = await http.post(url, headers: headers, body: data);
|
||||
if (res.statusCode != 200) throw Exception('http.post error: statusCode= ${res.statusCode}');
|
||||
print(res.body);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
void main() async {
|
||||
var headers = {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
};
|
||||
|
||||
var data = 'foo=\'bar\'';
|
||||
|
||||
var url = Uri.parse('http://example.com/');
|
||||
var res = await http.post(url, body: data);
|
||||
var res = await http.post(url, headers: headers, body: data);
|
||||
if (res.statusCode != 200) throw Exception('http.post error: statusCode= ${res.statusCode}');
|
||||
print(res.body);
|
||||
}
|
||||
|
||||
6
fixtures/dart/post_with_data_raw.dart
generated
6
fixtures/dart/post_with_data_raw.dart
generated
@@ -1,10 +1,14 @@
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
void main() async {
|
||||
var headers = {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
};
|
||||
|
||||
var data = 'msg1=wow&msg2=such&msg3=@rawmsg';
|
||||
|
||||
var url = Uri.parse('http://example.com/post');
|
||||
var res = await http.post(url, body: data);
|
||||
var res = await http.post(url, headers: headers, body: data);
|
||||
if (res.statusCode != 200) throw Exception('http.post error: statusCode= ${res.statusCode}');
|
||||
print(res.body);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
void main() async {
|
||||
var headers = {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
};
|
||||
|
||||
var data = 'foo="bar"';
|
||||
|
||||
var url = Uri.parse('http://example.com/');
|
||||
var res = await http.post(url, body: data);
|
||||
var res = await http.post(url, headers: headers, body: data);
|
||||
if (res.statusCode != 200) throw Exception('http.post error: statusCode= ${res.statusCode}');
|
||||
print(res.body);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
void main() async {
|
||||
var headers = {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
};
|
||||
|
||||
var data = 'foo="bar"';
|
||||
|
||||
var url = Uri.parse('http://example.com/');
|
||||
var res = await http.post(url, body: data);
|
||||
var res = await http.post(url, headers: headers, body: data);
|
||||
if (res.statusCode != 200) throw Exception('http.post error: statusCode= ${res.statusCode}');
|
||||
print(res.body);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
void main() async {
|
||||
var headers = {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
};
|
||||
|
||||
var data = 'foo=\'bar\'';
|
||||
|
||||
var url = Uri.parse('http://example.com/');
|
||||
var res = await http.post(url, body: data);
|
||||
var res = await http.post(url, headers: headers, body: data);
|
||||
if (res.statusCode != 200) throw Exception('http.post error: statusCode= ${res.statusCode}');
|
||||
print(res.body);
|
||||
}
|
||||
|
||||
2
fixtures/dart/put_basic_auth_json_data.dart
generated
2
fixtures/dart/put_basic_auth_json_data.dart
generated
@@ -7,8 +7,8 @@ void main() async {
|
||||
var authn = 'Basic ' + base64Encode(utf8.encode('$uname:$pword'));
|
||||
|
||||
var headers = {
|
||||
'Authorization': authn,
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'Authorization': authn,
|
||||
};
|
||||
|
||||
var data = '{"admins":{"names":[], "roles":[]}, "readers":{"names":["joe"],"roles":[]}}';
|
||||
|
||||
4
fixtures/elixir/multiple_d_post.ex
generated
4
fixtures/elixir/multiple_d_post.ex
generated
@@ -2,7 +2,9 @@ request = %HTTPoison.Request{
|
||||
method: :post,
|
||||
url: "https://cmdb.litop.local/webservices/rest.php",
|
||||
options: [],
|
||||
headers: [],
|
||||
headers: [
|
||||
{~s|Content-Type|, ~s|application/x-www-form-urlencoded|},
|
||||
],
|
||||
params: [],
|
||||
body: [
|
||||
{~s|version|, ~s|1.2|},
|
||||
|
||||
@@ -2,7 +2,9 @@ request = %HTTPoison.Request{
|
||||
method: :post,
|
||||
url: "http://localhost/api/oauth/token/",
|
||||
options: [hackney: [basic_auth: {~s|foo|, ~s|bar|}]],
|
||||
headers: [],
|
||||
headers: [
|
||||
{~s|Content-Type|, ~s|application/x-www-form-urlencoded|},
|
||||
],
|
||||
params: [],
|
||||
body: [
|
||||
{~s|grant_type|, ~s|client_credentials|}
|
||||
|
||||
4
fixtures/elixir/post_empty.ex
generated
4
fixtures/elixir/post_empty.ex
generated
@@ -2,7 +2,9 @@ request = %HTTPoison.Request{
|
||||
method: :post,
|
||||
url: "http://localhost:28139",
|
||||
options: [],
|
||||
headers: [],
|
||||
headers: [
|
||||
{~s|Content-Type|, ~s|application/x-www-form-urlencoded|},
|
||||
],
|
||||
params: [],
|
||||
body: ""
|
||||
}
|
||||
|
||||
@@ -2,7 +2,9 @@ request = %HTTPoison.Request{
|
||||
method: :post,
|
||||
url: "http://example.com/",
|
||||
options: [],
|
||||
headers: [],
|
||||
headers: [
|
||||
{~s|Content-Type|, ~s|application/x-www-form-urlencoded|},
|
||||
],
|
||||
params: [],
|
||||
body: [
|
||||
{~s|foo|, ~s|\\"bar\\"|}
|
||||
|
||||
@@ -2,7 +2,9 @@ request = %HTTPoison.Request{
|
||||
method: :post,
|
||||
url: "http://example.com/",
|
||||
options: [],
|
||||
headers: [],
|
||||
headers: [
|
||||
{~s|Content-Type|, ~s|application/x-www-form-urlencoded|},
|
||||
],
|
||||
params: [],
|
||||
body: [
|
||||
{~s|foo|, ~s|\\\'bar\\\'|}
|
||||
|
||||
4
fixtures/elixir/post_number.ex
generated
4
fixtures/elixir/post_number.ex
generated
@@ -2,7 +2,9 @@ request = %HTTPoison.Request{
|
||||
method: :post,
|
||||
url: "http://a.com",
|
||||
options: [],
|
||||
headers: [],
|
||||
headers: [
|
||||
{~s|Content-Type|, ~s|application/x-www-form-urlencoded|},
|
||||
],
|
||||
params: [],
|
||||
body: ~s|123|
|
||||
}
|
||||
|
||||
4
fixtures/elixir/post_quotes_inside_data.ex
generated
4
fixtures/elixir/post_quotes_inside_data.ex
generated
@@ -2,7 +2,9 @@ request = %HTTPoison.Request{
|
||||
method: :post,
|
||||
url: "http://google.com",
|
||||
options: [],
|
||||
headers: [],
|
||||
headers: [
|
||||
{~s|Content-Type|, ~s|application/x-www-form-urlencoded|},
|
||||
],
|
||||
params: [],
|
||||
body: [
|
||||
{~s|field|, ~s|don\'t you like quotes|}
|
||||
|
||||
@@ -2,7 +2,9 @@ request = %HTTPoison.Request{
|
||||
method: :post,
|
||||
url: "http://example.com/",
|
||||
options: [],
|
||||
headers: [],
|
||||
headers: [
|
||||
{~s|Content-Type|, ~s|application/x-www-form-urlencoded|},
|
||||
],
|
||||
params: [],
|
||||
body: [
|
||||
{~s|foo|, ~s|bar|},
|
||||
|
||||
4
fixtures/elixir/post_with_data_binary.ex
generated
4
fixtures/elixir/post_with_data_binary.ex
generated
@@ -2,7 +2,9 @@ request = %HTTPoison.Request{
|
||||
method: :post,
|
||||
url: "http://localhost:28139/post",
|
||||
options: [],
|
||||
headers: [],
|
||||
headers: [
|
||||
{~s|Content-Type|, ~s|application/x-www-form-urlencoded|},
|
||||
],
|
||||
params: [],
|
||||
body: ~s|{"title":"china1"}|
|
||||
}
|
||||
|
||||
4
fixtures/elixir/post_with_data_raw.ex
generated
4
fixtures/elixir/post_with_data_raw.ex
generated
@@ -2,7 +2,9 @@ request = %HTTPoison.Request{
|
||||
method: :post,
|
||||
url: "http://example.com/post",
|
||||
options: [],
|
||||
headers: [],
|
||||
headers: [
|
||||
{~s|Content-Type|, ~s|application/x-www-form-urlencoded|},
|
||||
],
|
||||
params: [],
|
||||
body: [
|
||||
{~s|msg1|, ~s|wow|},
|
||||
|
||||
@@ -2,7 +2,9 @@ request = %HTTPoison.Request{
|
||||
method: :post,
|
||||
url: "http://example.com/",
|
||||
options: [],
|
||||
headers: [],
|
||||
headers: [
|
||||
{~s|Content-Type|, ~s|application/x-www-form-urlencoded|},
|
||||
],
|
||||
params: [],
|
||||
body: [
|
||||
{~s|foo|, ~s|"bar"|}
|
||||
|
||||
@@ -2,7 +2,9 @@ request = %HTTPoison.Request{
|
||||
method: :post,
|
||||
url: "http://example.com/",
|
||||
options: [],
|
||||
headers: [],
|
||||
headers: [
|
||||
{~s|Content-Type|, ~s|application/x-www-form-urlencoded|},
|
||||
],
|
||||
params: [],
|
||||
body: [
|
||||
{~s|foo|, ~s|"bar"|}
|
||||
|
||||
@@ -2,7 +2,9 @@ request = %HTTPoison.Request{
|
||||
method: :post,
|
||||
url: "http://example.com/",
|
||||
options: [],
|
||||
headers: [],
|
||||
headers: [
|
||||
{~s|Content-Type|, ~s|application/x-www-form-urlencoded|},
|
||||
],
|
||||
params: [],
|
||||
body: [
|
||||
{~s|foo|, ~s|\'bar\'|}
|
||||
|
||||
4
fixtures/elixir/post_xpost.ex
generated
4
fixtures/elixir/post_xpost.ex
generated
@@ -2,7 +2,9 @@ request = %HTTPoison.Request{
|
||||
method: :post,
|
||||
url: "http://us.jooble.org/api/xxxxxxxxxxxxxxxx",
|
||||
options: [],
|
||||
headers: [],
|
||||
headers: [
|
||||
{~s|Content-Type|, ~s|application/x-www-form-urlencoded|},
|
||||
],
|
||||
params: [],
|
||||
body: ~s|{"keywords":"php","page":1,"searchMode":1}|
|
||||
}
|
||||
|
||||
4
fixtures/elixir/put_basic_auth_json_data.ex
generated
4
fixtures/elixir/put_basic_auth_json_data.ex
generated
@@ -2,7 +2,9 @@ request = %HTTPoison.Request{
|
||||
method: :put,
|
||||
url: "http://localhost:5984/test/_security",
|
||||
options: [hackney: [basic_auth: {~s|admin|, ~s|123|}]],
|
||||
headers: [],
|
||||
headers: [
|
||||
{~s|Content-Type|, ~s|application/x-www-form-urlencoded|},
|
||||
],
|
||||
params: [],
|
||||
body: ~s|{"admins":{"names":[], "roles":[]}, "readers":{"names":["joe"],"roles":[]}}|
|
||||
}
|
||||
|
||||
4
fixtures/elixir/put_with_file.ex
generated
4
fixtures/elixir/put_with_file.ex
generated
@@ -2,7 +2,9 @@ request = %HTTPoison.Request{
|
||||
method: :put,
|
||||
url: "http://awesomeurl.com/upload",
|
||||
options: [],
|
||||
headers: [],
|
||||
headers: [
|
||||
{~s|Content-Type|, ~s|application/x-www-form-urlencoded|},
|
||||
],
|
||||
params: [],
|
||||
body: {:file, ~s|new_file|}
|
||||
}
|
||||
|
||||
1
fixtures/go/post_empty.go
generated
1
fixtures/go/post_empty.go
generated
@@ -13,6 +13,7 @@ func main() {
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
||||
1
fixtures/go/post_with_data_raw.go
generated
1
fixtures/go/post_with_data_raw.go
generated
@@ -15,6 +15,7 @@ func main() {
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
||||
2
fixtures/java/j_patch_array.java
generated
2
fixtures/java/j_patch_array.java
generated
@@ -12,6 +12,8 @@ class Main {
|
||||
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
|
||||
httpConn.setRequestMethod("PATCH");
|
||||
|
||||
httpConn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
||||
|
||||
httpConn.setDoOutput(true);
|
||||
OutputStreamWriter writer = new OutputStreamWriter(httpConn.getOutputStream());
|
||||
writer.write("item[]=1&item[]=2&item[]=3");
|
||||
|
||||
2
fixtures/java/j_post_data_wo_verb.java
generated
2
fixtures/java/j_post_data_wo_verb.java
generated
@@ -12,6 +12,8 @@ class Main {
|
||||
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
|
||||
httpConn.setRequestMethod("POST");
|
||||
|
||||
httpConn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
||||
|
||||
httpConn.setDoOutput(true);
|
||||
OutputStreamWriter writer = new OutputStreamWriter(httpConn.getOutputStream());
|
||||
writer.write("data1=data1&data2=data2&data3=data3");
|
||||
|
||||
1
fixtures/java/multiline_post_with_data.java
generated
1
fixtures/java/multiline_post_with_data.java
generated
@@ -13,6 +13,7 @@ class Main {
|
||||
httpConn.setRequestMethod("GET");
|
||||
|
||||
httpConn.setRequestProperty("Origin", "http://fiddle.jshell.net");
|
||||
httpConn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
||||
|
||||
httpConn.setDoOutput(true);
|
||||
OutputStreamWriter writer = new OutputStreamWriter(httpConn.getOutputStream());
|
||||
|
||||
2
fixtures/java/multiple_d_post.java
generated
2
fixtures/java/multiple_d_post.java
generated
@@ -12,6 +12,8 @@ class Main {
|
||||
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
|
||||
httpConn.setRequestMethod("POST");
|
||||
|
||||
httpConn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
||||
|
||||
httpConn.setDoOutput(true);
|
||||
OutputStreamWriter writer = new OutputStreamWriter(httpConn.getOutputStream());
|
||||
writer.write("version=1.2&auth_user=fdgxf&auth_pwd=oxfdscds&json_data={ \"operation\": \"core/get\", \"class\": \"Software\", \"key\": \"key\" }");
|
||||
|
||||
@@ -13,6 +13,8 @@ class Main {
|
||||
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
|
||||
httpConn.setRequestMethod("POST");
|
||||
|
||||
httpConn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
||||
|
||||
byte[] message = ("foo:bar").getBytes("UTF-8");
|
||||
String basicAuth = DatatypeConverter.printBase64Binary(message);
|
||||
httpConn.setRequestProperty("Authorization", "Basic " + basicAuth);
|
||||
|
||||
2
fixtures/java/post_empty.java
generated
2
fixtures/java/post_empty.java
generated
@@ -11,6 +11,8 @@ class Main {
|
||||
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
|
||||
httpConn.setRequestMethod("POST");
|
||||
|
||||
httpConn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
||||
|
||||
InputStream responseStream = httpConn.getResponseCode() / 100 == 2
|
||||
? httpConn.getInputStream()
|
||||
: httpConn.getErrorStream();
|
||||
|
||||
@@ -12,6 +12,8 @@ class Main {
|
||||
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
|
||||
httpConn.setRequestMethod("POST");
|
||||
|
||||
httpConn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
||||
|
||||
httpConn.setDoOutput(true);
|
||||
OutputStreamWriter writer = new OutputStreamWriter(httpConn.getOutputStream());
|
||||
writer.write("foo=\\\"bar\\\"");
|
||||
|
||||
@@ -12,6 +12,8 @@ class Main {
|
||||
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
|
||||
httpConn.setRequestMethod("POST");
|
||||
|
||||
httpConn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
||||
|
||||
httpConn.setDoOutput(true);
|
||||
OutputStreamWriter writer = new OutputStreamWriter(httpConn.getOutputStream());
|
||||
writer.write("foo=\\'bar\\'");
|
||||
|
||||
2
fixtures/java/post_number.java
generated
2
fixtures/java/post_number.java
generated
@@ -12,6 +12,8 @@ class Main {
|
||||
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
|
||||
httpConn.setRequestMethod("POST");
|
||||
|
||||
httpConn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
||||
|
||||
httpConn.setDoOutput(true);
|
||||
OutputStreamWriter writer = new OutputStreamWriter(httpConn.getOutputStream());
|
||||
writer.write("123");
|
||||
|
||||
2
fixtures/java/post_quotes_inside_data.java
generated
2
fixtures/java/post_quotes_inside_data.java
generated
@@ -12,6 +12,8 @@ class Main {
|
||||
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
|
||||
httpConn.setRequestMethod("POST");
|
||||
|
||||
httpConn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
||||
|
||||
httpConn.setDoOutput(true);
|
||||
OutputStreamWriter writer = new OutputStreamWriter(httpConn.getOutputStream());
|
||||
writer.write("field=don%27t%20you%20like%20quotes");
|
||||
|
||||
@@ -12,6 +12,8 @@ class Main {
|
||||
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
|
||||
httpConn.setRequestMethod("POST");
|
||||
|
||||
httpConn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
||||
|
||||
httpConn.setDoOutput(true);
|
||||
OutputStreamWriter writer = new OutputStreamWriter(httpConn.getOutputStream());
|
||||
writer.write("foo=bar&foo=&foo=barbar");
|
||||
|
||||
2
fixtures/java/post_with_data_binary.java
generated
2
fixtures/java/post_with_data_binary.java
generated
@@ -12,6 +12,8 @@ class Main {
|
||||
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
|
||||
httpConn.setRequestMethod("POST");
|
||||
|
||||
httpConn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
||||
|
||||
httpConn.setDoOutput(true);
|
||||
OutputStreamWriter writer = new OutputStreamWriter(httpConn.getOutputStream());
|
||||
writer.write("{\"title\":\"china1\"}");
|
||||
|
||||
2
fixtures/java/post_with_data_raw.java
generated
2
fixtures/java/post_with_data_raw.java
generated
@@ -12,6 +12,8 @@ class Main {
|
||||
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
|
||||
httpConn.setRequestMethod("POST");
|
||||
|
||||
httpConn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
||||
|
||||
httpConn.setDoOutput(true);
|
||||
OutputStreamWriter writer = new OutputStreamWriter(httpConn.getOutputStream());
|
||||
writer.write("msg1=wow&msg2=such&msg3=@rawmsg");
|
||||
|
||||
@@ -12,6 +12,8 @@ class Main {
|
||||
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
|
||||
httpConn.setRequestMethod("POST");
|
||||
|
||||
httpConn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
||||
|
||||
httpConn.setDoOutput(true);
|
||||
OutputStreamWriter writer = new OutputStreamWriter(httpConn.getOutputStream());
|
||||
writer.write("secret=*%5*!");
|
||||
|
||||
@@ -12,6 +12,8 @@ class Main {
|
||||
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
|
||||
httpConn.setRequestMethod("POST");
|
||||
|
||||
httpConn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
||||
|
||||
httpConn.setDoOutput(true);
|
||||
OutputStreamWriter writer = new OutputStreamWriter(httpConn.getOutputStream());
|
||||
writer.write("foo=\"bar\"");
|
||||
|
||||
@@ -12,6 +12,8 @@ class Main {
|
||||
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
|
||||
httpConn.setRequestMethod("POST");
|
||||
|
||||
httpConn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
||||
|
||||
httpConn.setDoOutput(true);
|
||||
OutputStreamWriter writer = new OutputStreamWriter(httpConn.getOutputStream());
|
||||
writer.write("foo=\"bar\"");
|
||||
|
||||
1
fixtures/java/post_with_quotes_anywhere.java
generated
1
fixtures/java/post_with_quotes_anywhere.java
generated
@@ -16,6 +16,7 @@ class Main {
|
||||
httpConn.setRequestProperty("A", "''a'");
|
||||
httpConn.setRequestProperty("B", "\"");
|
||||
httpConn.setRequestProperty("Cookie", "x=1'; y=2\"");
|
||||
httpConn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
||||
|
||||
byte[] message = ("ol':asd\"").getBytes("UTF-8");
|
||||
String basicAuth = DatatypeConverter.printBase64Binary(message);
|
||||
|
||||
@@ -12,6 +12,8 @@ class Main {
|
||||
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
|
||||
httpConn.setRequestMethod("POST");
|
||||
|
||||
httpConn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
||||
|
||||
httpConn.setDoOutput(true);
|
||||
OutputStreamWriter writer = new OutputStreamWriter(httpConn.getOutputStream());
|
||||
writer.write("foo='bar'");
|
||||
|
||||
2
fixtures/java/post_xpost.java
generated
2
fixtures/java/post_xpost.java
generated
@@ -12,6 +12,8 @@ class Main {
|
||||
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
|
||||
httpConn.setRequestMethod("POST");
|
||||
|
||||
httpConn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
||||
|
||||
httpConn.setDoOutput(true);
|
||||
OutputStreamWriter writer = new OutputStreamWriter(httpConn.getOutputStream());
|
||||
writer.write("{\"keywords\":\"php\",\"page\":1,\"searchMode\":1}");
|
||||
|
||||
2
fixtures/java/put_basic_auth_json_data.java
generated
2
fixtures/java/put_basic_auth_json_data.java
generated
@@ -13,6 +13,8 @@ class Main {
|
||||
HttpURLConnection httpConn = (HttpURLConnection) url.openConnection();
|
||||
httpConn.setRequestMethod("PUT");
|
||||
|
||||
httpConn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
|
||||
|
||||
byte[] message = ("admin:123").getBytes("UTF-8");
|
||||
String basicAuth = DatatypeConverter.printBase64Binary(message);
|
||||
httpConn.setRequestProperty("Authorization", "Basic " + basicAuth);
|
||||
|
||||
5
fixtures/javascript/post_empty.js
generated
5
fixtures/javascript/post_empty.js
generated
@@ -1,3 +1,6 @@
|
||||
fetch('http://localhost:28139', {
|
||||
method: 'POST'
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
fetch('http://example.com/', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
body: 'foo=\"bar\"'
|
||||
});
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
fetch('http://example.com/', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
body: 'foo=\\\'bar\\\''
|
||||
});
|
||||
|
||||
2
fixtures/javascript/post_with_data_binary.js
generated
2
fixtures/javascript/post_with_data_binary.js
generated
@@ -1,7 +1,7 @@
|
||||
fetch('http://localhost:28139/post', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json; charset=UTF-8'
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
body: JSON.stringify({"title":"china1"})
|
||||
});
|
||||
|
||||
3
fixtures/javascript/post_with_data_raw.js
generated
3
fixtures/javascript/post_with_data_raw.js
generated
@@ -1,4 +1,7 @@
|
||||
fetch('http://example.com/post', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
body: 'msg1=wow&msg2=such&msg3=@rawmsg'
|
||||
});
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
fetch('http://example.com/', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
body: 'foo="bar"'
|
||||
});
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
fetch('http://example.com/', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
body: 'foo="bar"'
|
||||
});
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
fetch('http://example.com/', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
},
|
||||
body: 'foo=\'bar\''
|
||||
});
|
||||
|
||||
2
fixtures/javascript/put_basic_auth_json_data.js
generated
2
fixtures/javascript/put_basic_auth_json_data.js
generated
@@ -1,7 +1,7 @@
|
||||
fetch('http://localhost:5984/test/_security', {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
'Content-Type': 'application/json; charset=UTF-8',
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'Authorization': 'Basic ' + btoa('admin:123')
|
||||
},
|
||||
body: JSON.stringify({"admins":{"names":[], "roles":[]}, "readers":{"names":["joe"],"roles":[]}})
|
||||
|
||||
3
fixtures/json/j_data_priority_than_f.json
generated
3
fixtures/json/j_data_priority_than_f.json
generated
@@ -2,6 +2,9 @@
|
||||
"url": "http://httpbin.org/post",
|
||||
"raw_url": "http://httpbin.org/post",
|
||||
"method": "post",
|
||||
"headers": {
|
||||
"Content-Type": "application/x-www-form-urlencoded"
|
||||
},
|
||||
"data": {
|
||||
"data1": "data1",
|
||||
"data2": "data2",
|
||||
|
||||
3
fixtures/json/j_patch_array.json
generated
3
fixtures/json/j_patch_array.json
generated
@@ -2,6 +2,9 @@
|
||||
"url": "http://httpbin.org/patch",
|
||||
"raw_url": "http://httpbin.org/patch",
|
||||
"method": "patch",
|
||||
"headers": {
|
||||
"Content-Type": "application/x-www-form-urlencoded"
|
||||
},
|
||||
"data": {
|
||||
"item[]": [
|
||||
"1",
|
||||
|
||||
3
fixtures/json/j_post_data_wo_verb.json
generated
3
fixtures/json/j_post_data_wo_verb.json
generated
@@ -2,6 +2,9 @@
|
||||
"url": "http://httpbin.org/post",
|
||||
"raw_url": "http://httpbin.org/post",
|
||||
"method": "post",
|
||||
"headers": {
|
||||
"Content-Type": "application/x-www-form-urlencoded"
|
||||
},
|
||||
"data": {
|
||||
"data1": "data1",
|
||||
"data2": "data2",
|
||||
|
||||
3
fixtures/json/multiple_d_post.json
generated
3
fixtures/json/multiple_d_post.json
generated
@@ -2,6 +2,9 @@
|
||||
"url": "https://cmdb.litop.local/webservices/rest.php",
|
||||
"raw_url": "https://cmdb.litop.local/webservices/rest.php",
|
||||
"method": "post",
|
||||
"headers": {
|
||||
"Content-Type": "application/x-www-form-urlencoded"
|
||||
},
|
||||
"data": {
|
||||
"version": "1.2",
|
||||
"auth_user": "fdgxf",
|
||||
|
||||
3
fixtures/json/post_with_data_binary.json
generated
3
fixtures/json/post_with_data_binary.json
generated
@@ -2,6 +2,9 @@
|
||||
"url": "http://localhost:28139/post",
|
||||
"raw_url": "http://localhost:28139/post",
|
||||
"method": "post",
|
||||
"headers": {
|
||||
"Content-Type": "application/x-www-form-urlencoded"
|
||||
},
|
||||
"data": {
|
||||
"{\"title\":\"china1\"}": ""
|
||||
}
|
||||
|
||||
3
fixtures/json/post_with_data_raw.json
generated
3
fixtures/json/post_with_data_raw.json
generated
@@ -2,6 +2,9 @@
|
||||
"url": "http://example.com/post",
|
||||
"raw_url": "http://example.com/post",
|
||||
"method": "post",
|
||||
"headers": {
|
||||
"Content-Type": "application/x-www-form-urlencoded"
|
||||
},
|
||||
"data": {
|
||||
"msg1": "wow",
|
||||
"msg2": "such",
|
||||
|
||||
3
fixtures/json/post_xpost.json
generated
3
fixtures/json/post_xpost.json
generated
@@ -2,6 +2,9 @@
|
||||
"url": "http://us.jooble.org/api/xxxxxxxxxxxxxxxx",
|
||||
"raw_url": "http://us.jooble.org/api/xxxxxxxxxxxxxxxx",
|
||||
"method": "post",
|
||||
"headers": {
|
||||
"Content-Type": "application/x-www-form-urlencoded"
|
||||
},
|
||||
"data": {
|
||||
"{\"keywords\":\"php\",\"page\":1,\"searchMode\":1}": ""
|
||||
}
|
||||
|
||||
6
fixtures/matlab/multiple_d_post.m
generated
6
fixtures/matlab/multiple_d_post.m
generated
@@ -1,13 +1,15 @@
|
||||
%% Web Access using Data Import and Export API
|
||||
uri = 'https://cmdb.litop.local/webservices/rest.php';
|
||||
body = 'version=1.2&auth_user=fdgxf&auth_pwd=oxfdscds&json_data={ "operation": "core/get", "class": "Software", "key": "key" }';
|
||||
response = webwrite(uri, body);
|
||||
options = weboptions('MediaType', 'application/x-www-form-urlencoded');
|
||||
response = webwrite(uri, body, options);
|
||||
|
||||
%% HTTP Interface
|
||||
import matlab.net.*
|
||||
import matlab.net.http.*
|
||||
import matlab.net.http.io.*
|
||||
|
||||
header = HeaderField('Content-Type', 'application/x-www-form-urlencoded');
|
||||
uri = URI('https://cmdb.litop.local/webservices/rest.php');
|
||||
body = FormProvider(...
|
||||
'version', '1.2',...
|
||||
@@ -19,4 +21,4 @@ body = FormProvider(...
|
||||
'key', 'key'...
|
||||
))...
|
||||
);
|
||||
response = RequestMessage('post', [], body).send(uri.EncodedURI);
|
||||
response = RequestMessage('post', header, body).send(uri.EncodedURI);
|
||||
|
||||
@@ -3,7 +3,8 @@ uri = 'http://localhost/api/oauth/token/';
|
||||
body = 'grant_type=client_credentials';
|
||||
options = weboptions(...
|
||||
'Username', 'foo',...
|
||||
'Password', 'bar'...
|
||||
'Password', 'bar',...
|
||||
'MediaType', 'application/x-www-form-urlencoded'...
|
||||
);
|
||||
response = webwrite(uri, body, options);
|
||||
|
||||
@@ -12,8 +13,9 @@ import matlab.net.*
|
||||
import matlab.net.http.*
|
||||
import matlab.net.http.io.*
|
||||
|
||||
header = HeaderField('Content-Type', 'application/x-www-form-urlencoded');
|
||||
uri = URI('http://localhost/api/oauth/token/');
|
||||
cred = Credentials('Username', 'foo', 'Password', 'bar');
|
||||
options = HTTPOptions('Credentials', cred);
|
||||
body = FormProvider('grant_type', 'client_credentials');
|
||||
response = RequestMessage('post', [], body).send(uri.EncodedURI, options);
|
||||
response = RequestMessage('post', header, body).send(uri.EncodedURI, options);
|
||||
|
||||
6
fixtures/matlab/post_empty.m
generated
6
fixtures/matlab/post_empty.m
generated
@@ -1,13 +1,15 @@
|
||||
%% Web Access using Data Import and Export API
|
||||
uri = 'http://localhost:28139';
|
||||
body = '';
|
||||
response = webwrite(uri, body);
|
||||
options = weboptions('MediaType', 'application/x-www-form-urlencoded');
|
||||
response = webwrite(uri, body, options);
|
||||
|
||||
%% HTTP Interface
|
||||
import matlab.net.*
|
||||
import matlab.net.http.*
|
||||
import matlab.net.http.io.*
|
||||
|
||||
header = HeaderField('Content-Type', 'application/x-www-form-urlencoded');
|
||||
uri = URI('http://localhost:28139');
|
||||
body = FileProvider();
|
||||
response = RequestMessage('post', [], body).send(uri.EncodedURI);
|
||||
response = RequestMessage('post', header, body).send(uri.EncodedURI);
|
||||
|
||||
6
fixtures/matlab/post_number.m
generated
6
fixtures/matlab/post_number.m
generated
@@ -1,13 +1,15 @@
|
||||
%% Web Access using Data Import and Export API
|
||||
uri = 'http://a.com';
|
||||
body = '123';
|
||||
response = webwrite(uri, body);
|
||||
options = weboptions('MediaType', 'application/x-www-form-urlencoded');
|
||||
response = webwrite(uri, body, options);
|
||||
|
||||
%% HTTP Interface
|
||||
import matlab.net.*
|
||||
import matlab.net.http.*
|
||||
import matlab.net.http.io.*
|
||||
|
||||
header = HeaderField('Content-Type', 'application/x-www-form-urlencoded');
|
||||
uri = URI('http://a.com');
|
||||
body = JSONProvider(123);
|
||||
response = RequestMessage('post', [], body).send(uri.EncodedURI);
|
||||
response = RequestMessage('post', header, body).send(uri.EncodedURI);
|
||||
|
||||
6
fixtures/matlab/post_same_field_multiple_times.m
generated
6
fixtures/matlab/post_same_field_multiple_times.m
generated
@@ -1,13 +1,15 @@
|
||||
%% Web Access using Data Import and Export API
|
||||
uri = 'http://example.com/';
|
||||
body = 'foo=bar&foo=&foo=barbar';
|
||||
response = webwrite(uri, body);
|
||||
options = weboptions('MediaType', 'application/x-www-form-urlencoded');
|
||||
response = webwrite(uri, body, options);
|
||||
|
||||
%% HTTP Interface
|
||||
import matlab.net.*
|
||||
import matlab.net.http.*
|
||||
import matlab.net.http.io.*
|
||||
|
||||
header = HeaderField('Content-Type', 'application/x-www-form-urlencoded');
|
||||
uri = URI('http://example.com/');
|
||||
body = FormProvider('foo', 'bar', 'foo', '', 'foo', 'barbar');
|
||||
response = RequestMessage('post', [], body).send(uri.EncodedURI);
|
||||
response = RequestMessage('post', header, body).send(uri.EncodedURI);
|
||||
|
||||
6
fixtures/matlab/post_with_data_raw.m
generated
6
fixtures/matlab/post_with_data_raw.m
generated
@@ -1,13 +1,15 @@
|
||||
%% Web Access using Data Import and Export API
|
||||
uri = 'http://example.com/post';
|
||||
body = 'msg1=wow&msg2=such&msg3=@rawmsg';
|
||||
response = webwrite(uri, body);
|
||||
options = weboptions('MediaType', 'application/x-www-form-urlencoded');
|
||||
response = webwrite(uri, body, options);
|
||||
|
||||
%% HTTP Interface
|
||||
import matlab.net.*
|
||||
import matlab.net.http.*
|
||||
import matlab.net.http.io.*
|
||||
|
||||
header = HeaderField('Content-Type', 'application/x-www-form-urlencoded');
|
||||
uri = URI('http://example.com/post');
|
||||
body = FormProvider('msg1', 'wow', 'msg2', 'such', 'msg3', '@rawmsg');
|
||||
response = RequestMessage('post', [], body).send(uri.EncodedURI);
|
||||
response = RequestMessage('post', header, body).send(uri.EncodedURI);
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
%% Web Access using Data Import and Export API
|
||||
uri = 'http://example.com/';
|
||||
body = 'foo="bar"';
|
||||
response = webwrite(uri, body);
|
||||
options = weboptions('MediaType', 'application/x-www-form-urlencoded');
|
||||
response = webwrite(uri, body, options);
|
||||
|
||||
%% HTTP Interface
|
||||
import matlab.net.*
|
||||
import matlab.net.http.*
|
||||
import matlab.net.http.io.*
|
||||
|
||||
header = HeaderField('Content-Type', 'application/x-www-form-urlencoded');
|
||||
uri = URI('http://example.com/');
|
||||
body = FormProvider('foo', '"bar"');
|
||||
response = RequestMessage('post', [], body).send(uri.EncodedURI);
|
||||
response = RequestMessage('post', header, body).send(uri.EncodedURI);
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
%% Web Access using Data Import and Export API
|
||||
uri = 'http://example.com/';
|
||||
body = 'foo="bar"';
|
||||
response = webwrite(uri, body);
|
||||
options = weboptions('MediaType', 'application/x-www-form-urlencoded');
|
||||
response = webwrite(uri, body, options);
|
||||
|
||||
%% HTTP Interface
|
||||
import matlab.net.*
|
||||
import matlab.net.http.*
|
||||
import matlab.net.http.io.*
|
||||
|
||||
header = HeaderField('Content-Type', 'application/x-www-form-urlencoded');
|
||||
uri = URI('http://example.com/');
|
||||
body = FormProvider('foo', '"bar"');
|
||||
response = RequestMessage('post', [], body).send(uri.EncodedURI);
|
||||
response = RequestMessage('post', header, body).send(uri.EncodedURI);
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
%% Web Access using Data Import and Export API
|
||||
uri = 'http://example.com/';
|
||||
body = 'foo=''bar''';
|
||||
response = webwrite(uri, body);
|
||||
options = weboptions('MediaType', 'application/x-www-form-urlencoded');
|
||||
response = webwrite(uri, body, options);
|
||||
|
||||
%% HTTP Interface
|
||||
import matlab.net.*
|
||||
import matlab.net.http.*
|
||||
import matlab.net.http.io.*
|
||||
|
||||
header = HeaderField('Content-Type', 'application/x-www-form-urlencoded');
|
||||
uri = URI('http://example.com/');
|
||||
body = FormProvider('foo', '''bar''');
|
||||
response = RequestMessage('post', [], body).send(uri.EncodedURI);
|
||||
response = RequestMessage('post', header, body).send(uri.EncodedURI);
|
||||
|
||||
8
fixtures/matlab/put_with_file.m
generated
8
fixtures/matlab/put_with_file.m
generated
@@ -2,7 +2,10 @@
|
||||
uri = 'http://awesomeurl.com/upload';
|
||||
body = fileread('new_file');
|
||||
body(body==13 | body==10) = [];
|
||||
options = weboptions('RequestMethod', 'put');
|
||||
options = weboptions(...
|
||||
'RequestMethod', 'put',...
|
||||
'MediaType', 'application/x-www-form-urlencoded'...
|
||||
);
|
||||
response = webwrite(uri, body, options);
|
||||
|
||||
%% HTTP Interface
|
||||
@@ -10,7 +13,8 @@ import matlab.net.*
|
||||
import matlab.net.http.*
|
||||
import matlab.net.http.io.*
|
||||
|
||||
header = HeaderField('Content-Type', 'application/x-www-form-urlencoded');
|
||||
uri = URI('http://awesomeurl.com/upload');
|
||||
body = fileread('new_file');
|
||||
body(body==13 | body==10) = [];
|
||||
response = RequestMessage('put', [], body).send(uri.EncodedURI);
|
||||
response = RequestMessage('put', header, body).send(uri.EncodedURI);
|
||||
|
||||
7
fixtures/node-request/post_empty.js
generated
7
fixtures/node-request/post_empty.js
generated
@@ -1,8 +1,13 @@
|
||||
var request = require('request');
|
||||
|
||||
var headers = {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
};
|
||||
|
||||
var options = {
|
||||
url: 'http://localhost:28139',
|
||||
method: 'POST'
|
||||
method: 'POST',
|
||||
headers: headers
|
||||
};
|
||||
|
||||
function callback(error, response, body) {
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
var request = require('request');
|
||||
|
||||
var headers = {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
};
|
||||
|
||||
var dataString = 'foo=\"bar\"';
|
||||
|
||||
var options = {
|
||||
url: 'http://example.com/',
|
||||
method: 'POST',
|
||||
headers: headers,
|
||||
body: dataString
|
||||
};
|
||||
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
var request = require('request');
|
||||
|
||||
var headers = {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
};
|
||||
|
||||
var dataString = 'foo=\\\'bar\\\'';
|
||||
|
||||
var options = {
|
||||
url: 'http://example.com/',
|
||||
method: 'POST',
|
||||
headers: headers,
|
||||
body: dataString
|
||||
};
|
||||
|
||||
|
||||
5
fixtures/node-request/post_with_data_binary.js
generated
5
fixtures/node-request/post_with_data_binary.js
generated
@@ -1,10 +1,15 @@
|
||||
var request = require('request');
|
||||
|
||||
var headers = {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
};
|
||||
|
||||
var dataString = '{"title":"china1"}';
|
||||
|
||||
var options = {
|
||||
url: 'http://localhost:28139/post',
|
||||
method: 'POST',
|
||||
headers: headers,
|
||||
body: dataString
|
||||
};
|
||||
|
||||
|
||||
5
fixtures/node-request/post_with_data_raw.js
generated
5
fixtures/node-request/post_with_data_raw.js
generated
@@ -1,10 +1,15 @@
|
||||
var request = require('request');
|
||||
|
||||
var headers = {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
};
|
||||
|
||||
var dataString = 'msg1=wow&msg2=such&msg3=@rawmsg';
|
||||
|
||||
var options = {
|
||||
url: 'http://example.com/post',
|
||||
method: 'POST',
|
||||
headers: headers,
|
||||
body: dataString
|
||||
};
|
||||
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
var request = require('request');
|
||||
|
||||
var headers = {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
};
|
||||
|
||||
var dataString = 'foo="bar"';
|
||||
|
||||
var options = {
|
||||
url: 'http://example.com/',
|
||||
method: 'POST',
|
||||
headers: headers,
|
||||
body: dataString
|
||||
};
|
||||
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
var request = require('request');
|
||||
|
||||
var headers = {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
};
|
||||
|
||||
var dataString = 'foo="bar"';
|
||||
|
||||
var options = {
|
||||
url: 'http://example.com/',
|
||||
method: 'POST',
|
||||
headers: headers,
|
||||
body: dataString
|
||||
};
|
||||
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
var request = require('request');
|
||||
|
||||
var headers = {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
};
|
||||
|
||||
var dataString = 'foo=\'bar\'';
|
||||
|
||||
var options = {
|
||||
url: 'http://example.com/',
|
||||
method: 'POST',
|
||||
headers: headers,
|
||||
body: dataString
|
||||
};
|
||||
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
var request = require('request');
|
||||
|
||||
var headers = {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
};
|
||||
|
||||
var dataString = '{"admins":{"names":[], "roles":[]}, "readers":{"names":["joe"],"roles":[]}}';
|
||||
|
||||
var options = {
|
||||
url: 'http://localhost:5984/test/_security',
|
||||
method: 'PUT',
|
||||
headers: headers,
|
||||
body: dataString,
|
||||
auth: {
|
||||
'user': 'admin',
|
||||
|
||||
5
fixtures/node/post_empty.js
generated
5
fixtures/node/post_empty.js
generated
@@ -1,5 +1,8 @@
|
||||
var fetch = require('node-fetch');
|
||||
|
||||
fetch('http://localhost:28139', {
|
||||
method: 'POST'
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
}
|
||||
});
|
||||
|
||||
4
fixtures/parser/get_with_browser_headers.json
generated
4
fixtures/parser/get_with_browser_headers.json
generated
@@ -28,6 +28,7 @@
|
||||
]
|
||||
],
|
||||
"compressed": true,
|
||||
"method": "get",
|
||||
"headers": [
|
||||
[
|
||||
"Accept-Encoding",
|
||||
@@ -57,6 +58,5 @@
|
||||
"Connection",
|
||||
"keep-alive"
|
||||
]
|
||||
],
|
||||
"method": "get"
|
||||
]
|
||||
}
|
||||
|
||||
8
fixtures/parser/multiline_post_with_data.json
generated
8
fixtures/parser/multiline_post_with_data.json
generated
@@ -1,14 +1,18 @@
|
||||
{
|
||||
"url": "http://fiddle.jshell.net/echo/html/",
|
||||
"urlWithoutQuery": "http://fiddle.jshell.net/echo/html/",
|
||||
"method": "get",
|
||||
"data": "msg1=value1&msg2=value2",
|
||||
"headers": [
|
||||
[
|
||||
"Origin",
|
||||
"http://fiddle.jshell.net"
|
||||
],
|
||||
[
|
||||
"Content-Type",
|
||||
"application/x-www-form-urlencoded"
|
||||
]
|
||||
],
|
||||
"method": "get",
|
||||
"data": "msg1=value1&msg2=value2",
|
||||
"dataArray": [
|
||||
"msg1=value1",
|
||||
"msg2=value2"
|
||||
|
||||
4
fixtures/parser/post_with_browser_headers.json
generated
4
fixtures/parser/post_with_browser_headers.json
generated
@@ -16,6 +16,7 @@
|
||||
]
|
||||
],
|
||||
"compressed": true,
|
||||
"method": "post",
|
||||
"headers": [
|
||||
[
|
||||
"Origin",
|
||||
@@ -53,6 +54,5 @@
|
||||
"Content-Length",
|
||||
"0"
|
||||
]
|
||||
],
|
||||
"method": "post"
|
||||
]
|
||||
}
|
||||
|
||||
6
fixtures/parser/post_with_urlencoded_data.json
generated
6
fixtures/parser/post_with_urlencoded_data.json
generated
@@ -2,6 +2,8 @@
|
||||
"url": "http://fiddle.jshell.net/echo/html/",
|
||||
"urlWithoutQuery": "http://fiddle.jshell.net/echo/html/",
|
||||
"compressed": true,
|
||||
"method": "post",
|
||||
"data": "msg1=wow&msg2=such",
|
||||
"headers": [
|
||||
[
|
||||
"Origin",
|
||||
@@ -39,7 +41,5 @@
|
||||
"Connection",
|
||||
"keep-alive"
|
||||
]
|
||||
],
|
||||
"method": "post",
|
||||
"data": "msg1=wow&msg2=such"
|
||||
]
|
||||
}
|
||||
|
||||
3
fixtures/php/post_quotes_inside_data.php
generated
3
fixtures/php/post_quotes_inside_data.php
generated
@@ -3,6 +3,9 @@ $ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, 'google.com');
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||
'Content-Type' => 'application/x-www-form-urlencoded',
|
||||
]);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, 'field=don%27t%20you%20like%20quotes');
|
||||
|
||||
$response = curl_exec($ch);
|
||||
|
||||
3
fixtures/php/post_with_data_raw.php
generated
3
fixtures/php/post_with_data_raw.php
generated
@@ -3,6 +3,9 @@ $ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, 'http://example.com/post');
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||
'Content-Type' => 'application/x-www-form-urlencoded',
|
||||
]);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, 'msg1=wow&msg2=such&msg3=@rawmsg');
|
||||
|
||||
$response = curl_exec($ch);
|
||||
|
||||
1
fixtures/php/post_with_quotes_anywhere.php
generated
1
fixtures/php/post_with_quotes_anywhere.php
generated
@@ -6,6 +6,7 @@ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||
'A' => '\'\'a\'',
|
||||
'B' => '"',
|
||||
'Content-Type' => 'application/x-www-form-urlencoded',
|
||||
]);
|
||||
curl_setopt($ch, CURLOPT_COOKIE, 'x=1\'; y=2"');
|
||||
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
|
||||
|
||||
3
fixtures/php/put_basic_auth_json_data.php
generated
3
fixtures/php/put_basic_auth_json_data.php
generated
@@ -3,6 +3,9 @@ $ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, 'http://localhost:5984/test/_security');
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
||||
'Content-Type' => 'application/x-www-form-urlencoded',
|
||||
]);
|
||||
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
|
||||
curl_setopt($ch, CURLOPT_USERPWD, 'admin:123');
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"admins":{"names":[], "roles":[]}, "readers":{"names":["joe"],"roles":[]}}');
|
||||
|
||||
6
fixtures/python/multiple_d_post.py
generated
6
fixtures/python/multiple_d_post.py
generated
@@ -1,5 +1,9 @@
|
||||
import requests
|
||||
|
||||
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" }'
|
||||
|
||||
response = requests.post('https://cmdb.litop.local/webservices/rest.php', data=data)
|
||||
response = requests.post('https://cmdb.litop.local/webservices/rest.php', headers=headers, data=data)
|
||||
|
||||
6
fixtures/python/post_empty.py
generated
6
fixtures/python/post_empty.py
generated
@@ -1,3 +1,7 @@
|
||||
import requests
|
||||
|
||||
response = requests.post('http://localhost:28139')
|
||||
headers = {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
}
|
||||
|
||||
response = requests.post('http://localhost:28139', headers=headers)
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
import requests
|
||||
|
||||
headers = {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
}
|
||||
|
||||
data = 'foo=\\"bar\\"'
|
||||
|
||||
response = requests.post('http://example.com/', data=data)
|
||||
response = requests.post('http://example.com/', headers=headers, data=data)
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
import requests
|
||||
|
||||
headers = {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
}
|
||||
|
||||
data = 'foo=\\\'bar\\\''
|
||||
|
||||
response = requests.post('http://example.com/', data=data)
|
||||
response = requests.post('http://example.com/', headers=headers, data=data)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user