@@ -653,7 +653,7 @@ def http_request(
653
653
retry_transient_errors : Optional [bool ] = None ,
654
654
max_retries : int = 10 ,
655
655
** kwargs : Any ,
656
- ) -> requests . Response :
656
+ ) -> _backends . DefaultResponse :
657
657
"""Make an HTTP request to the Gitlab server.
658
658
659
659
Args:
@@ -749,7 +749,7 @@ def http_request(
749
749
self ._check_redirects (result .response )
750
750
751
751
if 200 <= result .status_code < 300 :
752
- return result . response
752
+ return result
753
753
754
754
def should_retry () -> bool :
755
755
if result .status_code == 429 and obey_rate_limit :
@@ -827,9 +827,10 @@ def http_get(
827
827
GitlabParsingError: If the json data could not be parsed
828
828
"""
829
829
query_data = query_data or {}
830
- result = self .http_request (
830
+ backend_response = self .http_request (
831
831
"get" , path , query_data = query_data , streamed = streamed , ** kwargs
832
832
)
833
+ result = backend_response .response
833
834
834
835
if (
835
836
result .headers ["Content-Type" ] == "application/json"
@@ -866,8 +867,10 @@ def http_head(
866
867
"""
867
868
868
869
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
871
874
872
875
def http_list (
873
876
self ,
@@ -1023,7 +1026,7 @@ def http_post(
1023
1026
query_data = query_data or {}
1024
1027
post_data = post_data or {}
1025
1028
1026
- result = self .http_request (
1029
+ backend_response = self .http_request (
1027
1030
"post" ,
1028
1031
path ,
1029
1032
query_data = query_data ,
@@ -1032,6 +1035,8 @@ def http_post(
1032
1035
raw = raw ,
1033
1036
** kwargs ,
1034
1037
)
1038
+ result = backend_response .response
1039
+
1035
1040
try :
1036
1041
if result .headers .get ("Content-Type" , None ) == "application/json" :
1037
1042
json_result = result .json ()
@@ -1075,7 +1080,7 @@ def http_put(
1075
1080
query_data = query_data or {}
1076
1081
post_data = post_data or {}
1077
1082
1078
- result = self .http_request (
1083
+ backend_response = self .http_request (
1079
1084
"put" ,
1080
1085
path ,
1081
1086
query_data = query_data ,
@@ -1085,7 +1090,7 @@ def http_put(
1085
1090
** kwargs ,
1086
1091
)
1087
1092
try :
1088
- json_result = result .json ()
1093
+ json_result = backend_response .json ()
1089
1094
if TYPE_CHECKING :
1090
1095
assert isinstance (json_result , dict )
1091
1096
return json_result
@@ -1124,7 +1129,7 @@ def http_patch(
1124
1129
query_data = query_data or {}
1125
1130
post_data = post_data or {}
1126
1131
1127
- result = self .http_request (
1132
+ backend_response = self .http_request (
1128
1133
"patch" ,
1129
1134
path ,
1130
1135
query_data = query_data ,
@@ -1133,7 +1138,7 @@ def http_patch(
1133
1138
** kwargs ,
1134
1139
)
1135
1140
try :
1136
- json_result = result .json ()
1141
+ json_result = backend_response .json ()
1137
1142
if TYPE_CHECKING :
1138
1143
assert isinstance (json_result , dict )
1139
1144
return json_result
@@ -1156,7 +1161,8 @@ def http_delete(self, path: str, **kwargs: Any) -> requests.Response:
1156
1161
Raises:
1157
1162
GitlabHttpError: When the return code is not 2xx
1158
1163
"""
1159
- return self .http_request ("delete" , path , ** kwargs )
1164
+ backend_response = self .http_request ("delete" , path , ** kwargs )
1165
+ return backend_response .response
1160
1166
1161
1167
@gitlab .exceptions .on_http_error (gitlab .exceptions .GitlabSearchError )
1162
1168
def search (
@@ -1210,7 +1216,11 @@ def _query(
1210
1216
self , url : str , query_data : Optional [Dict [str , Any ]] = None , ** kwargs : Any
1211
1217
) -> None :
1212
1218
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
+
1214
1224
try :
1215
1225
next_url = result .links ["next" ]["url" ]
1216
1226
except KeyError :
0 commit comments