Handle UnicodeEncodeError when parsing querystring (#2170)
This commit is contained in:
parent
6fb85ac430
commit
c739c5331e
2 changed files with 18 additions and 3 deletions
|
|
@ -152,11 +152,18 @@ class BaseResponse(_TemplateEnvironmentMixin):
|
|||
for key, value in flat.items():
|
||||
querystring[key] = [value]
|
||||
elif self.body:
|
||||
querystring.update(parse_qs(raw_body, keep_blank_values=True))
|
||||
try:
|
||||
querystring.update(parse_qs(raw_body, keep_blank_values=True))
|
||||
except UnicodeEncodeError:
|
||||
pass # ignore encoding errors, as the body may not contain a legitimate querystring
|
||||
if not querystring:
|
||||
querystring.update(headers)
|
||||
|
||||
querystring = _decode_dict(querystring)
|
||||
try:
|
||||
querystring = _decode_dict(querystring)
|
||||
except UnicodeDecodeError:
|
||||
pass # ignore decoding errors, as the body may not contain a legitimate querystring
|
||||
|
||||
self.uri = full_url
|
||||
self.path = urlparse(full_url).path
|
||||
self.querystring = querystring
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue