@@ -572,11 +572,11 @@ def _check_redirects(self, result: requests.Response) -> None:
572
572
)
573
573
)
574
574
575
+ @staticmethod
575
576
def _prepare_send_data (
576
- self ,
577
577
files : Optional [Dict [str , Any ]] = None ,
578
578
post_data : Optional [Union [Dict [str , Any ], bytes ]] = None ,
579
- raw : bool = False ,
579
+ raw_post_data : bool = False ,
580
580
) -> Tuple [
581
581
Optional [Union [Dict [str , Any ], bytes ]],
582
582
Optional [Union [Dict [str , Any ], MultipartEncoder ]],
@@ -599,7 +599,7 @@ def _prepare_send_data(
599
599
data = MultipartEncoder (post_data )
600
600
return (None , data , data .content_type )
601
601
602
- if raw and post_data :
602
+ if raw_post_data and post_data :
603
603
return (None , post_data , "application/octet-stream" )
604
604
605
605
return (post_data , None , "application/json" )
@@ -611,7 +611,7 @@ def http_request(
611
611
path : str ,
612
612
query_data : Optional [Dict [str , Any ]] = None ,
613
613
post_data : Optional [Union [Dict [str , Any ], bytes ]] = None ,
614
- raw : bool = False ,
614
+ raw_post_data : bool = False ,
615
615
streamed : bool = False ,
616
616
files : Optional [Dict [str , Any ]] = None ,
617
617
timeout : Optional [float ] = None ,
@@ -628,7 +628,7 @@ def http_request(
628
628
query_data: Data to send as query parameters
629
629
post_data: Data to send in the body (will be converted to
630
630
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
632
632
streamed: Whether the data should be streamed
633
633
files: The files to send to the server
634
634
timeout: The timeout, in seconds, for the request
@@ -673,7 +673,9 @@ def http_request(
673
673
timeout = opts_timeout
674
674
675
675
# 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
+ )
677
679
opts ["headers" ]["Content-type" ] = content_type
678
680
679
681
cur_retries = 0
@@ -829,7 +831,7 @@ def http_post(
829
831
path : str ,
830
832
query_data : Optional [Dict [str , Any ]] = None ,
831
833
post_data : Optional [Dict [str , Any ]] = None ,
832
- raw : bool = False ,
834
+ raw_post_data : bool = False ,
833
835
files : Optional [Dict [str , Any ]] = None ,
834
836
** kwargs : Any ,
835
837
) -> Union [Dict [str , Any ], requests .Response ]:
@@ -862,6 +864,7 @@ def http_post(
862
864
query_data = query_data ,
863
865
post_data = post_data ,
864
866
files = files ,
867
+ raw_post_data = raw_post_data ,
865
868
** kwargs ,
866
869
)
867
870
try :
@@ -878,10 +881,10 @@ def http_put(
878
881
path : str ,
879
882
query_data : Optional [Dict [str , Any ]] = None ,
880
883
post_data : Optional [Union [Dict [str , Any ], bytes ]] = None ,
881
- raw : bool = False ,
884
+ raw_post_data : bool = False ,
882
885
files : Optional [Dict [str , Any ]] = None ,
883
886
** kwargs : Any ,
884
- ) -> Union [ Dict [str , Any ], requests . Response ]:
887
+ ) -> Dict [str , Any ]:
885
888
"""Make a PUT request to the Gitlab server.
886
889
887
890
Args:
@@ -890,7 +893,7 @@ def http_put(
890
893
query_data: Data to send as query parameters
891
894
post_data: Data to send in the body (will be converted to
892
895
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
894
897
files: The files to send to the server
895
898
**kwargs: Extra options to send to the server (e.g. sudo)
896
899
@@ -910,7 +913,7 @@ def http_put(
910
913
query_data = query_data ,
911
914
post_data = post_data ,
912
915
files = files ,
913
- raw = raw ,
916
+ raw_post_data = raw_post_data ,
914
917
** kwargs ,
915
918
)
916
919
try :
0 commit comments