@@ -567,9 +567,9 @@ def verify_options_request(self, url, expected_status_code, headers=None):
567567 )
568568 return response
569569
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 ):
571571 """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 )
573573 if response .status_code != expected_status_code :
574574 raise StatusCodeError (
575575 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):
650650 )
651651 return response
652652
653- def do_post_request (self , url : str , body_obj ):
653+ def do_post_request_with_logging (self , url : str , body_obj , requestHeaders = None ):
654654 """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 ()
656661 if self .internal :
657662 REQUEST_LOGGER .info (
658663 "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 },
660665 )
661666 return response
0 commit comments