@@ -567,9 +567,9 @@ def verify_options_request(self, url, expected_status_code, headers=None):
567
567
)
568
568
return response
569
569
570
- def verify_post_request (self , url : str , body_obj , expected_status_code : int ):
570
+ def verify_post_request (self , url : str , body_obj , expected_status_code : int , headers = None ):
571
571
"""Return response to POST request and verify matches expected status code."""
572
- response = self .do_post_request (url , body_obj )
572
+ response = self .do_post_request_with_logging (url , body_obj , headers )
573
573
if response .status_code != expected_status_code :
574
574
raise StatusCodeError (
575
575
f"Request to { url } failed with status: { response .status_code } , expected status: { expected_status_code } "
@@ -650,12 +650,17 @@ def do_options_request_with_logging(self, url, headers=None):
650
650
)
651
651
return response
652
652
653
- def do_post_request (self , url : str , body_obj ):
653
+ def do_post_request_with_logging (self , url : str , body_obj , requestHeaders = None ):
654
654
"""Perform a POST request with dict body body_obj."""
655
- response = requests .post (url , json = body_obj )
655
+ response = (
656
+ requests .post (url , json = body_obj , headers = requestHeaders )
657
+ if requestHeaders
658
+ else requests .post (url , json = body_obj )
659
+ )
660
+ amazon_headers = RequestUtils (response ).get_amazon_headers ()
656
661
if self .internal :
657
662
REQUEST_LOGGER .info (
658
663
"POST request made to " + url ,
659
- extra = {"test" : self .testcase , "status" : response .status_code },
664
+ extra = {"test" : self .testcase , "status" : response .status_code , "headers" : amazon_headers },
660
665
)
661
666
return response
0 commit comments