File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -99,6 +99,10 @@ def sign(
9999 )
100100
101101 signing_fields = self ._normalize_signing_fields (request = new_request )
102+ #If any headers have been added, make sure those are reflected in the new request
103+ for field_name , field_value in signing_fields .items ():
104+ if field_name not in request .fields :
105+ new_request .fields .set_field (Field (name = field_name , values = [field_value ]))
102106 credential_scope = self ._scope (signing_properties = new_signing_properties )
103107 credential = f"{ identity .access_key_id } /{ credential_scope } "
104108 authorization = self .generate_authorization_field (
@@ -476,6 +480,10 @@ async def sign(
476480 )
477481
478482 signing_fields = await self ._normalize_signing_fields (request = new_request )
483+ #If any headers have been added, make sure those are reflected in the new request
484+ for field_name , field_value in signing_fields .items ():
485+ if field_name not in request .fields :
486+ new_request .fields .set_field (Field (name = field_name , values = [field_value ]))
479487 credential_scope = await self ._scope (signing_properties = new_signing_properties )
480488 credential = f"{ identity .access_key_id } /{ credential_scope } "
481489 authorization = await self .generate_authorization_field (
Original file line number Diff line number Diff line change @@ -94,6 +94,8 @@ def test_sign_doesnt_modify_original_request(
9494 assert signed_request is not aws_request
9595 assert aws_request .fields == original_request .fields
9696 assert signed_request .fields != aws_request .fields
97+ assert 'host' in signed_request .fields
98+ assert 'authorization' in signed_request .fields
9799
98100 @typing .no_type_check
99101 def test_sign_with_invalid_identity (
You can’t perform that action at this time.
0 commit comments