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

Commit cd594bd

Browse files
committed
Fixed to pass a port number specified by the user with http://
1 parent 9d11301 commit cd594bd

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

hyper/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def __init__(self):
130130
if value:
131131
setattr(info, attr, value)
132132

133-
if info.scheme == 'http':
133+
if info.scheme == 'http' and not _result.port:
134134
info.port = 80
135135

136136
if info.netloc:

test/test_cli.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,8 @@ def test_set_request_data(args, expected):
185185
{'host': 'example.com', 'port': 80, 'path': '/', 'scheme': 'http'}),
186186
(DummyNamespace({'_url': 'http://example.com/'}),
187187
{'host': 'example.com', 'port': 80, 'path': '/', 'scheme': 'http'}),
188+
(DummyNamespace({'_url': 'http://example.com:8080'}),
189+
{'host': 'example.com', 'port': 8080, 'path': '/', 'scheme': 'http'}),
188190
(DummyNamespace({'_url': 'https://example.com'}),
189191
{'host': 'example.com', 'port': 443, 'path': '/', 'scheme': 'https'}),
190192
(DummyNamespace({'_url': 'https://example.com/httpbin/get'}),
@@ -200,6 +202,7 @@ def test_set_request_data(args, expected):
200202
'set hostname with port number',
201203
'set url with http://',
202204
'set url + "/" with http://',
205+
'set url with http:// and port number',
203206
'set url with https://',
204207
'set url with path',
205208
'set url with port number and path',

0 commit comments

Comments
 (0)