Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions httpie/cli/argparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,16 @@ def _process_url(self):
else:
self.args.url = scheme + self.args.url

# Encode unescaped # characters in the query string as %23.
# urlparse treats # as a fragment separator, so a # inside query params
# (e.g., ?id=#1001) would incorrectly split the URL and lose data.
# See <https://github.com/httpie/cli/issues/1546>
qmark = self.args.url.find('?')
if qmark != -1:
before_query = self.args.url[:qmark + 1]
after_query = self.args.url[qmark + 1:]
self.args.url = before_query + after_query.replace('#', '%23')

def _setup_standard_streams(self):
"""
Modify `env.stdout` and `env.stdout_isatty` based on args, if needed.
Expand Down
Loading