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

Commit 095c50e

Browse files
committed
Enable override default headers from CLI
1 parent bb62f80 commit 095c50e

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

hyper/cli.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,14 @@ def set_request_data(args):
164164
body, headers, params = {}, {}, {}
165165
for i in args.items:
166166
if i.sep == SEP_HEADERS:
167-
# :key:value case
168-
if i.key == '':
169-
k, v = i.value.split(':')
170-
headers[':' + k] = v
171-
else:
167+
if i.key:
172168
headers[i.key] = i.value
169+
else:
170+
# when overriding a HTTP/2 special header there will be a leading
171+
# colon, which tricks the command line parser into thinking
172+
# the header is empty
173+
k, v = i.value.split(':', 1)
174+
headers[':' + k] = v
173175
elif i.sep == SEP_QUERY:
174176
params[i.key] = i.value
175177
elif i.sep == SEP_DATA:

0 commit comments

Comments
 (0)