Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlm committed Jun 7, 2023
1 parent 0680e36 commit d3a007f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
3 changes: 0 additions & 3 deletions botocore/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
encodebytes,
ensure_unicode,
parse_qs,
parse_qsl,
quote,
unquote,
urlsplit,
Expand Down Expand Up @@ -165,8 +164,6 @@ def add_auth(self, request):
if request.data:
# POST
params = request.data
if not isinstance(params, dict):
params = dict(parse_qsl(params))
else:
# GET
params = request.params
Expand Down
15 changes: 12 additions & 3 deletions botocore/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1148,22 +1148,31 @@ def remove_content_type_header_for_presigning(request, **kwargs):
del request.headers['Content-Type']


def urlencode_body(model, params, **kwargs):
def urlencode_body(model, params, context, **kwargs):
"""Urlencode the request body if it is a dictionary.
This is used for services like S3 that require the body to be urlencoded
when the body is a dictionary.
"""
body = params.get('body')
if model.service_model.protocol == 'query' and isinstance(body, dict):
if (
context['client_config'].signature_version != 'v2'
and model.service_model.protocol == 'query'
and isinstance(body, dict)
):
params['body'] = urlencode(body, doseq=True, encoding='utf-8').encode(
'utf-8'
)


def compress_request(model, params, context, **kwargs):
body = params.get('body')
if model.request_compression and body is not None:
config = context['client_config']
if config.signature_version == 'v2':
logger.debug(
"Request compression is not supported for signature version 2"
)
elif model.request_compression and body is not None:
AWS_REQUEST_COMPRESSOR.compress(body, context['client_config'], model)


Expand Down

0 comments on commit d3a007f

Please sign in to comment.