Skip to content
This repository was archived by the owner on Jan 13, 2021. It is now read-only.

Commit 2f3b9c3

Browse files
committed
Merge pull request #168 from Lukasa/issue/167
Pass args and kwargs through in get_response.
2 parents ac2ecd4 + a1d7bf0 commit 2f3b9c3

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

HISTORY.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ dev
2020
straight to the terminal.
2121
- Added new ``--h2`` flag to the Hyper CLI tool, which allows straight HTTP/2
2222
in plaintext, rather than attempting to upgrade from HTTP/1.1.
23+
- Allow arguments and keyword arguments in abstract version of
24+
``get_response``.
2325

2426
*Software Updates*
2527

hyper/common/connection.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class HTTPConnection(object):
2626
``'http2bin.org'``, ``'http2bin.org:443'`` or ``'127.0.0.1'``.
2727
:param port: (optional) The port to connect to. If not provided and one also
2828
isn't provided in the ``host`` parameter, defaults to 443.
29-
:param secure: (optional) Whether the request should use TLS.
29+
:param secure: (optional) Whether the request should use TLS.
3030
Defaults to ``False`` for most requests, but to ``True`` for any
3131
request issued to port 443.
3232
:param window_manager: (optional) The class to use to manage flow control
@@ -116,18 +116,18 @@ def request(self, method, url, body=None, headers={}):
116116
method=method, url=url, body=body, headers=headers
117117
)
118118

119-
def get_response(self):
119+
def get_response(self, *args, **kwargs):
120120
"""
121121
Returns a response object.
122122
"""
123123
try:
124-
return self._conn.get_response()
124+
return self._conn.get_response(*args, **kwargs)
125125
except HTTPUpgrade as e:
126-
# We upgraded via the HTTP Upgrade mechanism. We can just
127-
# go straight to the world of HTTP/2. Replace the backing object
126+
# We upgraded via the HTTP Upgrade mechanism. We can just
127+
# go straight to the world of HTTP/2. Replace the backing object
128128
# and insert the socket into it.
129129
assert e.negotiated == H2C_PROTOCOL
130-
130+
131131
self._conn = HTTP20Connection(
132132
self._host, self._port, **self._h2_kwargs
133133
)
@@ -139,7 +139,7 @@ def get_response(self):
139139

140140
# HTTP/2 preamble must be sent after receipt of a HTTP/1.1 101
141141
self._conn._send_preamble()
142-
142+
143143
return self._conn.get_response(1)
144144

145145
# The following two methods are the implementation of the context manager

0 commit comments

Comments
 (0)