Title: Problem sending JSON data as request body · Issue #206 · python-hyper/hyper · GitHub
Open Graph Title: Problem sending JSON data as request body · Issue #206 · python-hyper/hyper
X Title: Problem sending JSON data as request body · Issue #206 · python-hyper/hyper
Description: 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 inclu...
Open Graph Description: 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 inform...
X Description: 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 inform...
Opengraph URL: https://github.com/python-hyper/hyper/issues/206
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Problem sending JSON data as request body","articleBody":"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:\n\n```\nfrom hyper import HTTPConnection\nconn = HTTPConnection('nghttp2.org:443')\n\nreq = conn.request(\n 'POST',\n '/httpbin/post',\n body=b'{\"foo\": \"bar\"}',\n)\n\nresp = conn.get_response()\nprint(resp.read())\n```\n\nUsing a different http2 client, I get the expected response:\n\n```\n{\n \"args\": {},\n \"data\": \"{\\\"foo\\\": \\\"bar\\\"}\", \u003c-- critical bit right here\n \"files\": {},\n \"form\": {},\n \"headers\": {\n \"Accept\": \"*/*\",\n \"Accept-Encoding\": \"gzip, deflate\",\n \"Accept-Language\": \"en-US,en;q=0.8\",\n \"Cache-Control\": \"no-cache\",\n \"Content-Length\": \"14\",\n \"Content-Type\": \"application/json\",\n \"Csp\": \"active\",\n \"Host\": \"nghttp2.org\",\n \"Origin\": \"chrome-extension://aicmkgpgakddgnaphhhpliifpcfhicfo\",\n \"Postman-Token\": \"70fa24f0-9e35-82ef-c838-7c15461ba3bd\",\n \"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\",\n \"Via\": \"2 nghttpx\"\n },\n \"json\": {\n \"foo\": \"bar\"\n },\n \"origin\": \"68.180.88.224\",\n \"url\": \"https://nghttp2.org/httpbin/post\"\n}\n```\n\nBut using the python given above, I get the response: \n\n```\n{\n \"args\": {},\n \"data\": \"\",\n \"files\": {},\n \"form\": {},\n \"headers\": {\n \"Host\": \"nghttp2.org\",\n \"Transfer-Encoding\": \"chunked\",\n \"Via\": \"2 nghttpx\"\n },\n \"json\": null,\n \"origin\": \"68.180.88.224\",\n \"url\": \"https://nghttp2.org/httpbin/post\"\n}\n```\n\nI'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?\n","author":{"url":"https://github.com/lily-mara","@type":"Person","name":"lily-mara"},"datePublished":"2016-02-26T00:13:12.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":11},"url":"https://github.com/206/hyper/issues/206"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:a72b15dc-316c-8753-63fa-1d805d8e75e6 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9212:1E4FEF:15719AE:1BB5AB0:696B21E5 |
| html-safe-nonce | 9e986fee78adbe406b29cbf55051be145ac763420ab4d761369b42432638cd11 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MjEyOjFFNEZFRjoxNTcxOUFFOjFCQjVBQjA6Njk2QjIxRTUiLCJ2aXNpdG9yX2lkIjoiNDIyMzExNTU5MTU3Nzk2OTEyNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 26711ad016a3b76a4129ee39fc9196f029ef6a09ddd5b070b888298bac7d765a |
| hovercard-subject-tag | issue:136553923 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python-hyper/hyper/206/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2360e67d98baba66d42790d89089f753984ddcd8598f3431982f6ba4710aac5c/python-hyper/hyper/issues/206 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2360e67d98baba66d42790d89089f753984ddcd8598f3431982f6ba4710aac5c/python-hyper/hyper/issues/206 |
| og:image:alt | 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 inform... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | lily-mara |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5f99f7c1d70f01da5b93e5ca90303359738944d8ab470e396496262c66e60b8d |
| turbo-cache-control | no-preview |
| go-import | github.com/python-hyper/hyper git https://github.com/python-hyper/hyper.git |
| octolytics-dimension-user_id | 13035907 |
| octolytics-dimension-user_login | python-hyper |
| octolytics-dimension-repository_id | 16165969 |
| octolytics-dimension-repository_nwo | python-hyper/hyper |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 16165969 |
| octolytics-dimension-repository_network_root_nwo | python-hyper/hyper |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 82560a55c6b2054555076f46e683151ee28a19bc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width