@@ -653,7 +653,7 @@ def http_request(
653653 retry_transient_errors : Optional [bool ] = None ,
654654 max_retries : int = 10 ,
655655 ** kwargs : Any ,
656- ) -> requests . Response :
656+ ) -> _backends . DefaultResponse :
657657 """Make an HTTP request to the Gitlab server.
658658
659659 Args:
@@ -749,7 +749,7 @@ def http_request(
749749 self ._check_redirects (result .response )
750750
751751 if 200 <= result .status_code < 300 :
752- return result . response
752+ return result
753753
754754 def should_retry () -> bool :
755755 if result .status_code == 429 and obey_rate_limit :
@@ -827,9 +827,10 @@ def http_get(
827827 GitlabParsingError: If the json data could not be parsed
828828 """
829829 query_data = query_data or {}
830- result = self .http_request (
830+ backend_response = self .http_request (
831831 "get" , path , query_data = query_data , streamed = streamed , ** kwargs
832832 )
833+ result = backend_response .response
833834
834835 if (
835836 result .headers ["Content-Type" ] == "application/json"
@@ -866,8 +867,10 @@ def http_head(
866867 """
867868
868869 query_data = query_data or {}
869- result = self .http_request ("head" , path , query_data = query_data , ** kwargs )
870- return result .headers
870+ backend_response = self .http_request (
871+ "head" , path , query_data = query_data , ** kwargs
872+ )
873+ return backend_response .headers
871874
872875 def http_list (
873876 self ,
@@ -1023,7 +1026,7 @@ def http_post(
10231026 query_data = query_data or {}
10241027 post_data = post_data or {}
10251028
1026- result = self .http_request (
1029+ backend_response = self .http_request (
10271030 "post" ,
10281031 path ,
10291032 query_data = query_data ,
@@ -1032,6 +1035,8 @@ def http_post(
10321035 raw = raw ,
10331036 ** kwargs ,
10341037 )
1038+ result = backend_response .response
1039+
10351040 try :
10361041 if result .headers .get ("Content-Type" , None ) == "application/json" :
10371042 json_result = result .json ()
@@ -1075,7 +1080,7 @@ def http_put(
10751080 query_data = query_data or {}
10761081 post_data = post_data or {}
10771082
1078- result = self .http_request (
1083+ backend_response = self .http_request (
10791084 "put" ,
10801085 path ,
10811086 query_data = query_data ,
@@ -1085,7 +1090,7 @@ def http_put(
10851090 ** kwargs ,
10861091 )
10871092 try :
1088- json_result = result .json ()
1093+ json_result = backend_response .json ()
10891094 if TYPE_CHECKING :
10901095 assert isinstance (json_result , dict )
10911096 return json_result
@@ -1124,7 +1129,7 @@ def http_patch(
11241129 query_data = query_data or {}
11251130 post_data = post_data or {}
11261131
1127- result = self .http_request (
1132+ backend_response = self .http_request (
11281133 "patch" ,
11291134 path ,
11301135 query_data = query_data ,
@@ -1133,7 +1138,7 @@ def http_patch(
11331138 ** kwargs ,
11341139 )
11351140 try :
1136- json_result = result .json ()
1141+ json_result = backend_response .json ()
11371142 if TYPE_CHECKING :
11381143 assert isinstance (json_result , dict )
11391144 return json_result
@@ -1156,7 +1161,8 @@ def http_delete(self, path: str, **kwargs: Any) -> requests.Response:
11561161 Raises:
11571162 GitlabHttpError: When the return code is not 2xx
11581163 """
1159- return self .http_request ("delete" , path , ** kwargs )
1164+ backend_response = self .http_request ("delete" , path , ** kwargs )
1165+ return backend_response .response
11601166
11611167 @gitlab .exceptions .on_http_error (gitlab .exceptions .GitlabSearchError )
11621168 def search (
@@ -1210,7 +1216,11 @@ def _query(
12101216 self , url : str , query_data : Optional [Dict [str , Any ]] = None , ** kwargs : Any
12111217 ) -> None :
12121218 query_data = query_data or {}
1213- result = self ._gl .http_request ("get" , url , query_data = query_data , ** kwargs )
1219+ backend_response = self ._gl .http_request (
1220+ "get" , url , query_data = query_data , ** kwargs
1221+ )
1222+ result = backend_response .response
1223+
12141224 try :
12151225 next_url = result .links ["next" ]["url" ]
12161226 except KeyError :
0 commit comments