I am trying to do some testing using the http2 version of httbin: https://nghttp2.org/httpbin/. Posting to the url https://nghttp2.org/httpbin/post will respond with a JSON object containing information about the request. This JSON includes the body and data sent with the request. Using hyper, it appears that the data that I'm sending as the request body is not being sent. Here's an example:
from hyper import HTTPConnection
conn = HTTPConnection('nghttp2.org:443')
req = conn.request(
'POST',
'/httpbin/post',
body=b'{"foo": "bar"}',
)
resp = conn.get_response()
print(resp.read())
Using a different http2 client, I get the expected response:
{
"args": {},
"data": "{\"foo\": \"bar\"}", <-- critical bit right here
"files": {},
"form": {},
"headers": {
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate",
"Accept-Language": "en-US,en;q=0.8",
"Cache-Control": "no-cache",
"Content-Length": "14",
"Content-Type": "application/json",
"Csp": "active",
"Host": "nghttp2.org",
"Origin": "chrome-extension://aicmkgpgakddgnaphhhpliifpcfhicfo",
"Postman-Token": "70fa24f0-9e35-82ef-c838-7c15461ba3bd",
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/43.0.2357.130 Chrome/43.0.2357.130 Safari/537.36",
"Via": "2 nghttpx"
},
"json": {
"foo": "bar"
},
"origin": "68.180.88.224",
"url": "https://nghttp2.org/httpbin/post"
}
But using the python given above, I get the response:
{
"args": {},
"data": "",
"files": {},
"form": {},
"headers": {
"Host": "nghttp2.org",
"Transfer-Encoding": "chunked",
"Via": "2 nghttpx"
},
"json": null,
"origin": "68.180.88.224",
"url": "https://nghttp2.org/httpbin/post"
}
I'm using version 0.5.0 of hyper, Python 3.4.4. Am I doing something wrong with my request, or is there a way to get more verbose output from hyper so that I can see what's really going on?
I am trying to do some testing using the http2 version of httbin: https://nghttp2.org/httpbin/. Posting to the url
https://nghttp2.org/httpbin/postwill respond with a JSON object containing information about the request. This JSON includes the body and data sent with the request. Using hyper, it appears that the data that I'm sending as the request body is not being sent. Here's an example:Using a different http2 client, I get the expected response:
But using the python given above, I get the response:
I'm using version 0.5.0 of hyper, Python 3.4.4. Am I doing something wrong with my request, or is there a way to get more verbose output from hyper so that I can see what's really going on?