Curl generation query params bug (Fixes #810)

This commit is contained in:
Gregory Schier
2018-03-26 13:50:43 -07:00
parent 87ccc34bad
commit d5b75c7d32
392 changed files with 13180 additions and 4 deletions

View File

@@ -0,0 +1,14 @@
import http.client
conn = http.client.HTTPConnection("mockbin.com")
payload = "foo=bar&hello=world"
headers = { 'content-type': "application/x-www-form-urlencoded" }
conn.request("POST", "/har", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

View File

@@ -0,0 +1,14 @@
import http.client
conn = http.client.HTTPConnection("mockbin.com")
payload = "{\"number\":1,\"string\":\"f\\\"oo\",\"arr\":[1,2,3],\"nested\":{\"a\":\"b\"},\"arr_mix\":[1,\"a\",{\"arr_mix_nested\":{}}],\"boolean\":false}"
headers = { 'content-type': "application/json" }
conn.request("POST", "/har", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

View File

@@ -0,0 +1,12 @@
import http.client
conn = http.client.HTTPConnection("mockbin.com")
headers = { 'cookie': "foo=bar; bar=baz" }
conn.request("POST", "/har", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

View File

@@ -0,0 +1,10 @@
import http.client
conn = http.client.HTTPConnection("mockbin.com")
conn.request("PROPFIND", "/har")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

View File

@@ -0,0 +1,18 @@
import http.client
conn = http.client.HTTPConnection("mockbin.com")
payload = "foo=bar"
headers = {
'cookie': "foo=bar; bar=baz",
'accept': "application/json",
'content-type': "application/x-www-form-urlencoded"
}
conn.request("POST", "/har?foo=bar&foo=baz&baz=abc&key=value", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

View File

@@ -0,0 +1,15 @@
import http.client
conn = http.client.HTTPConnection("mockbin.com")
headers = {
'accept': "application/json",
'x-foo': "Bar"
}
conn.request("GET", "/har", headers=headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

View File

@@ -0,0 +1,10 @@
import http.client
conn = http.client.HTTPSConnection("mockbin.com")
conn.request("GET", "/har")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

View File

@@ -0,0 +1,14 @@
import http.client
conn = http.client.HTTPConnection("mockbin.com")
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"foo\"; filename=\"hello.txt\"\r\nContent-Type: text/plain\r\n\r\nHello World\r\n-----011000010111000001101001--\r\n"
headers = { 'content-type': "multipart/form-data; boundary=---011000010111000001101001" }
conn.request("POST", "/har", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

View File

@@ -0,0 +1,14 @@
import http.client
conn = http.client.HTTPConnection("mockbin.com")
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"foo\"; filename=\"hello.txt\"\r\nContent-Type: text/plain\r\n\r\n\r\n-----011000010111000001101001--\r\n"
headers = { 'content-type': "multipart/form-data; boundary=---011000010111000001101001" }
conn.request("POST", "/har", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

View File

@@ -0,0 +1,14 @@
import http.client
conn = http.client.HTTPConnection("mockbin.com")
payload = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"foo\"\r\n\r\nbar\r\n-----011000010111000001101001--\r\n"
headers = { 'content-type': "multipart/form-data; boundary=---011000010111000001101001" }
conn.request("POST", "/har", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

View File

@@ -0,0 +1,10 @@
import http.client
conn = http.client.HTTPConnection("mockbin.com")
conn.request("GET", "/har?foo=bar&foo=baz&baz=abc&key=value")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

View File

@@ -0,0 +1,10 @@
import http.client
conn = http.client.HTTPConnection("mockbin.com")
conn.request("GET", "/har")
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

View File

@@ -0,0 +1,14 @@
import http.client
conn = http.client.HTTPConnection("mockbin.com")
payload = "Hello World"
headers = { 'content-type': "text/plain" }
conn.request("POST", "/har", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))