@@ -572,11 +572,11 @@ def _check_redirects(self, result: requests.Response) -> None:
572572 )
573573 )
574574
575+ @staticmethod
575576 def _prepare_send_data (
576- self ,
577577 files : Optional [Dict [str , Any ]] = None ,
578578 post_data : Optional [Union [Dict [str , Any ], bytes ]] = None ,
579- raw : bool = False ,
579+ raw_post_data : bool = False ,
580580 ) -> Tuple [
581581 Optional [Union [Dict [str , Any ], bytes ]],
582582 Optional [Union [Dict [str , Any ], MultipartEncoder ]],
@@ -599,7 +599,7 @@ def _prepare_send_data(
599599 data = MultipartEncoder (post_data )
600600 return (None , data , data .content_type )
601601
602- if raw and post_data :
602+ if raw_post_data and post_data :
603603 return (None , post_data , "application/octet-stream" )
604604
605605 return (post_data , None , "application/json" )
@@ -611,7 +611,7 @@ def http_request(
611611 path : str ,
612612 query_data : Optional [Dict [str , Any ]] = None ,
613613 post_data : Optional [Union [Dict [str , Any ], bytes ]] = None ,
614- raw : bool = False ,
614+ raw_post_data : bool = False ,
615615 streamed : bool = False ,
616616 files : Optional [Dict [str , Any ]] = None ,
617617 timeout : Optional [float ] = None ,
@@ -628,7 +628,7 @@ def http_request(
628628 query_data: Data to send as query parameters
629629 post_data: Data to send in the body (will be converted to
630630 json by default)
631- raw : If True, do not convert post_data to json
631+ raw_post_data : If True, do not convert post_data to json
632632 streamed: Whether the data should be streamed
633633 files: The files to send to the server
634634 timeout: The timeout, in seconds, for the request
@@ -673,7 +673,9 @@ def http_request(
673673 timeout = opts_timeout
674674
675675 # We need to deal with json vs. data when uploading files
676- json , data , content_type = self ._prepare_send_data (files , post_data , raw )
676+ json , data , content_type = self ._prepare_send_data (
677+ files , post_data , raw_post_data
678+ )
677679 opts ["headers" ]["Content-type" ] = content_type
678680
679681 cur_retries = 0
@@ -829,7 +831,7 @@ def http_post(
829831 path : str ,
830832 query_data : Optional [Dict [str , Any ]] = None ,
831833 post_data : Optional [Dict [str , Any ]] = None ,
832- raw : bool = False ,
834+ raw_post_data : bool = False ,
833835 files : Optional [Dict [str , Any ]] = None ,
834836 ** kwargs : Any ,
835837 ) -> Union [Dict [str , Any ], requests .Response ]:
@@ -862,6 +864,7 @@ def http_post(
862864 query_data = query_data ,
863865 post_data = post_data ,
864866 files = files ,
867+ raw_post_data = raw_post_data ,
865868 ** kwargs ,
866869 )
867870 try :
@@ -878,10 +881,10 @@ def http_put(
878881 path : str ,
879882 query_data : Optional [Dict [str , Any ]] = None ,
880883 post_data : Optional [Union [Dict [str , Any ], bytes ]] = None ,
881- raw : bool = False ,
884+ raw_post_data : bool = False ,
882885 files : Optional [Dict [str , Any ]] = None ,
883886 ** kwargs : Any ,
884- ) -> Union [ Dict [str , Any ], requests . Response ]:
887+ ) -> Dict [str , Any ]:
885888 """Make a PUT request to the Gitlab server.
886889
887890 Args:
@@ -890,7 +893,7 @@ def http_put(
890893 query_data: Data to send as query parameters
891894 post_data: Data to send in the body (will be converted to
892895 json by default)
893- raw : If True, do not convert post_data to json
896+ raw_post_data : If True, do not convert post_data to json
894897 files: The files to send to the server
895898 **kwargs: Extra options to send to the server (e.g. sudo)
896899
@@ -910,7 +913,7 @@ def http_put(
910913 query_data = query_data ,
911914 post_data = post_data ,
912915 files = files ,
913- raw = raw ,
916+ raw_post_data = raw_post_data ,
914917 ** kwargs ,
915918 )
916919 try :
0 commit comments