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

Commit 6a79c38

Browse files
committed
Merge pull request #156 from Lukasa/issue/154
Stop being clever with bytes in CLI tool.
2 parents 3b0e688 + 765256f commit 6a79c38

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

HISTORY.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ dev
1616
a stream.
1717
- Prevent hyper from emitting lots of RST_STREAM frames.
1818
- Hyper CLI tool now correctly uses TLS for any ``https``-schemed URL.
19+
- Hyper CLI tool no longer attempts to decode bytes, instead writing them
20+
straight to the terminal.
1921

2022
*Software Updates*
2123

hyper/cli.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -223,17 +223,15 @@ def request(args):
223223
response = conn.get_response()
224224
log.debug('Response Headers:\n%s', pformat(response.headers))
225225
ctype, charset = get_content_type_and_charset(response)
226-
data = response.read().decode(charset)
227-
if 'json' in ctype:
228-
data = pformat(json.loads(data))
226+
data = response.read()
229227
return data
230228

231229

232230
def main(argv=None):
233231
args = parse_argument(argv)
234232
log.debug('Commandline Argument: %s', args)
235233
data = request(args)
236-
write_to_stdout(data.encode(PREFERRED_ENCODING, errors='replace'))
234+
write_to_stdout(data)
237235

238236

239237
if __name__ == '__main__': # pragma: no cover

0 commit comments

Comments
 (0)