@@ -427,15 +427,16 @@ def websockets_with_custom_handshake(
427
427
websocket_proxy_options = websocket_proxy_options ,
428
428
** kwargs )
429
429
430
- def _add_username_parameter (input_string , parameter_value , parameter_pretext , added_string_to_username ):
430
+ def _add_to_username_parameter (input_string , parameter_value , parameter_pretext ):
431
431
"""
432
432
Helper function to add parameters to the username in the direct_with_custom_authorizer function
433
433
"""
434
434
return_string = input_string
435
- if added_string_to_username is False :
436
- return_string += "?"
437
- else :
435
+
436
+ if not return_string .find ("?" ) is - 1 :
438
437
return_string += "&"
438
+ else :
439
+ return_string += "?"
439
440
440
441
if not parameter_value .find (parameter_pretext ) is - 1 :
441
442
return return_string + parameter_value
@@ -474,7 +475,6 @@ def direct_with_custom_authorizer(
474
475
475
476
_check_required_kwargs (** kwargs )
476
477
username_string = ""
477
- added_string_to_username = False
478
478
479
479
if auth_username is None :
480
480
if not _get (kwargs , "username" ) is None :
@@ -483,12 +483,11 @@ def direct_with_custom_authorizer(
483
483
username_string += auth_username
484
484
485
485
if not auth_authorizer_name is None :
486
- username_string = _add_username_parameter (
487
- username_string , auth_authorizer_name , "x-amz-customauthorizer-name=" , added_string_to_username )
488
- added_string_to_username = True
486
+ username_string = _add_to_username_parameter (
487
+ username_string , auth_authorizer_name , "x-amz-customauthorizer-name=" )
489
488
if not auth_authorizer_signature is None :
490
- username_string = _add_username_parameter (
491
- username_string , auth_authorizer_signature , "x-amz-customauthorizer-signature=" , added_string_to_username )
489
+ username_string = _add_to_username_parameter (
490
+ username_string , auth_authorizer_signature , "x-amz-customauthorizer-signature=" )
492
491
493
492
kwargs ["username" ] = username_string
494
493
kwargs ["password" ] = auth_password
0 commit comments