fix: removes `content-header` from AWS IMDS get request (#1934) · googleapis/google-auth-library-python@97bfea9

@@ -1306,7 +1306,7 @@ def test_retrieve_subject_token_success_temp_creds_no_environment_vars(

13061306

self.assert_aws_metadata_request_kwargs(

13071307

request.call_args_list[2][1],

13081308

"{}/{}".format(SECURITY_CREDS_URL, self.AWS_ROLE),

1309-

{"Content-Type": "application/json"},

1309+

None,

13101310

)

1311131113121312

# Retrieve subject_token again. Region should not be queried again.

@@ -1329,7 +1329,7 @@ def test_retrieve_subject_token_success_temp_creds_no_environment_vars(

13291329

self.assert_aws_metadata_request_kwargs(

13301330

new_request.call_args_list[1][1],

13311331

"{}/{}".format(SECURITY_CREDS_URL, self.AWS_ROLE),

1332-

{"Content-Type": "application/json"},

1332+

None,

13331333

)

1334133413351335

@mock.patch("google.auth._helpers.utcnow")

@@ -1394,7 +1394,6 @@ def test_retrieve_subject_token_success_temp_creds_no_environment_vars_idmsv2(

13941394

request.call_args_list[4][1],

13951395

"{}/{}".format(SECURITY_CREDS_URL, self.AWS_ROLE),

13961396

{

1397-

"Content-Type": "application/json",

13981397

"X-aws-ec2-metadata-token": self.AWS_IMDSV2_SESSION_TOKEN,

13991398

},

14001399

)

@@ -1431,7 +1430,6 @@ def test_retrieve_subject_token_success_temp_creds_no_environment_vars_idmsv2(

14311430

new_request.call_args_list[2][1],

14321431

"{}/{}".format(SECURITY_CREDS_URL, self.AWS_ROLE),

14331432

{

1434-

"Content-Type": "application/json",

14351433

"X-aws-ec2-metadata-token": self.AWS_IMDSV2_SESSION_TOKEN,

14361434

},

14371435

)

@@ -1488,7 +1486,6 @@ def test_retrieve_subject_token_success_temp_creds_environment_vars_missing_secr

14881486

request.call_args_list[2][1],

14891487

"{}/{}".format(SECURITY_CREDS_URL, self.AWS_ROLE),

14901488

{

1491-

"Content-Type": "application/json",

14921489

"X-aws-ec2-metadata-token": self.AWS_IMDSV2_SESSION_TOKEN,

14931490

},

14941491

)

@@ -1545,7 +1542,6 @@ def test_retrieve_subject_token_success_temp_creds_environment_vars_missing_acce

15451542

request.call_args_list[2][1],

15461543

"{}/{}".format(SECURITY_CREDS_URL, self.AWS_ROLE),

15471544

{

1548-

"Content-Type": "application/json",

15491545

"X-aws-ec2-metadata-token": self.AWS_IMDSV2_SESSION_TOKEN,

15501546

},

15511547

)

@@ -1596,7 +1592,6 @@ def test_retrieve_subject_token_success_temp_creds_environment_vars_missing_cred

15961592

request.call_args_list[2][1],

15971593

"{}/{}".format(SECURITY_CREDS_URL, self.AWS_ROLE),

15981594

{

1599-

"Content-Type": "application/json",

16001595

"X-aws-ec2-metadata-token": self.AWS_IMDSV2_SESSION_TOKEN,

16011596

},

16021597

)

@@ -1684,7 +1679,6 @@ def test_retrieve_subject_token_success_ipv6(self, utcnow):

16841679

request.call_args_list[4][1],

16851680

"{}/{}".format(SECURITY_CREDS_URL_IPV6, self.AWS_ROLE),

16861681

{

1687-

"Content-Type": "application/json",

16881682

"X-aws-ec2-metadata-token": self.AWS_IMDSV2_SESSION_TOKEN,

16891683

},

16901684

)