Skip to content

Commit 768ee03

Browse files
committed
g3bench: add coverage testcase for http POST
1 parent d02cf14 commit 768ee03

File tree

2 files changed

+47
-11
lines changed

2 files changed

+47
-11
lines changed

scripts/coverage/g3bench/target_h1.sh

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
# Http
33

4-
test_http()
4+
test_http_get()
55
{
66
URL=$1
77

@@ -17,12 +17,24 @@ test_http()
1717
g3bench h1 "${URL}" -x socks5h://t1:[email protected]:1080 --ok-status 200
1818
}
1919

20-
test_http http://httpbin.local/get
21-
test_http http://httpbin.local:2080/get
20+
test_http_post()
21+
{
22+
URL=$1
23+
24+
g3bench h1 "${URL}" --method POST --payload 31323334 --ok-status 200
25+
g3bench h1 "${URL}" --method POST --payload 31323334 --binary --ok-status 200
26+
g3bench h1 "${URL}" --method POST --payload name=foo -H "Content-Type: application/x-www-form-urlencoded" --ok-status 200
27+
}
28+
29+
test_http_get http://httpbin.local/get
30+
test_http_get http://httpbin.local:2080/get
31+
32+
test_http_post http://httpbin.local/post
33+
test_http_post http://httpbin.local:2080/post
2234

2335
# Https
2436

25-
test_https()
37+
test_https_get()
2638
{
2739
URL=$1
2840

@@ -38,5 +50,17 @@ test_https()
3850
g3bench h1 "${URL}" -x socks5h://t1:[email protected]:1080 --ok-status 200 --tls-ca-cert "${TEST_CA_CERT_FILE}"
3951
}
4052

41-
test_https https://httpbin.local:9443/get
42-
test_https https://httpbin.local:2443/get
53+
test_https_post()
54+
{
55+
URL=$1
56+
57+
g3bench h1 "${URL}" --method POST --payload 31323334 --ok-status 200 --tls-ca-cert "${TEST_CA_CERT_FILE}"
58+
g3bench h1 "${URL}" --method POST --payload 31323334 --binary --ok-status 200 --tls-ca-cert "${TEST_CA_CERT_FILE}"
59+
g3bench h1 "${URL}" --method POST --payload name=foo -H "Content-Type: application/x-www-form-urlencoded" --ok-status 200 --tls-ca-cert "${TEST_CA_CERT_FILE}"
60+
}
61+
62+
test_https_get https://httpbin.local:9443/get
63+
test_https_get https://httpbin.local:2443/get
64+
65+
test_https_post https://httpbin.local:9443/post
66+
test_https_post https://httpbin.local:2443/post
Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,22 @@
11

2-
g3bench h2 https://httpbin.local:2443/get --ok-status 200 --tls-ca-cert "${TEST_CA_CERT_FILE}"
2+
# GET
33

4-
g3bench h2 https://httpbin.local:2443/get -H "Accept: application/json" --ok-status 200 --tls-ca-cert "${TEST_CA_CERT_FILE}"
4+
URL=https://httpbin.local:2443/get
55

6-
g3bench h2 https://httpbin.local:2443/get -x http://t1:[email protected]:8080 --ok-status 200 --tls-ca-cert "${TEST_CA_CERT_FILE}"
6+
g3bench h2 "${URL}" --ok-status 200 --tls-ca-cert "${TEST_CA_CERT_FILE}"
77

8-
g3bench h2 https://httpbin.local:2443/get -x https://t1:[email protected]:8443 --proxy-tls-ca-cert "${TEST_CA_CERT_FILE}" --ok-status 200 --tls-ca-cert "${TEST_CA_CERT_FILE}"
8+
g3bench h2 "${URL}" -H "Accept: application/json" --ok-status 200 --tls-ca-cert "${TEST_CA_CERT_FILE}"
99

10-
g3bench h2 https://httpbin.local:2443/get -x socks5h://t1:[email protected]:1080 --ok-status 200 --tls-ca-cert "${TEST_CA_CERT_FILE}"
10+
g3bench h2 "${URL}" -x http://t1:[email protected]:8080 --ok-status 200 --tls-ca-cert "${TEST_CA_CERT_FILE}"
11+
12+
g3bench h2 "${URL}" -x https://t1:[email protected]:8443 --proxy-tls-ca-cert "${TEST_CA_CERT_FILE}" --ok-status 200 --tls-ca-cert "${TEST_CA_CERT_FILE}"
13+
14+
g3bench h2 "${URL}" -x socks5h://t1:[email protected]:1080 --ok-status 200 --tls-ca-cert "${TEST_CA_CERT_FILE}"
15+
16+
# POST
17+
18+
URL=https://httpbin.local:2443/post
19+
20+
g3bench h2 "${URL}" --method POST --payload 31323334 --ok-status 200 --tls-ca-cert "${TEST_CA_CERT_FILE}"
21+
g3bench h2 "${URL}" --method POST --payload 31323334 --binary --ok-status 200 --tls-ca-cert "${TEST_CA_CERT_FILE}"
22+
g3bench h2 "${URL}" --method POST --payload name=foo -H "Content-Type: application/x-www-form-urlencoded" --ok-status 200 --tls-ca-cert "${TEST_CA_CERT_FILE}"

0 commit comments

Comments
 (0)