| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent ff45124 commit e15349c
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1083,6 +1083,8 @@ def http_patch( | |||
| 1083 | 1083 | raw=raw, | |
| 1084 | 1084 | **kwargs, | |
| 1085 | 1085 | ) | |
| 1086 | + if result.status_code in gitlab.const.NO_JSON_RESPONSE_CODES: | ||
| 1087 | + return result | ||
| 1086 | 1088 | try: | |
| 1087 | 1089 | json_result = result.json() | |
| 1088 | 1090 | if TYPE_CHECKING: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -95,6 +95,7 @@ class SearchScope(GitlabEnum): | |||
| 95 | 95 | ||
| 96 | 96 | USER_AGENT: str = f"{__title__}/{__version__}" | |
| 97 | 97 | ||
| 98 | + NO_JSON_RESPONSE_CODES = [204] | ||
| 98 | 99 | RETRYABLE_TRANSIENT_ERROR_CODES = [500, 502, 503, 504] + list(range(520, 531)) | |
| 99 | 100 | ||
| 100 | 101 | __all__ = [ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -800,6 +800,21 @@ def test_patch_request(gl): | |||
| 800 | 800 | assert responses.assert_call_count(url, 1) is True | |
| 801 | 801 | ||
| 802 | 802 | ||
| 803 | + @responses.activate | ||
| 804 | + def test_patch_request_204(gl): | ||
| 805 | + url = "http://localhost/api/v4/projects" | ||
| 806 | + responses.add( | ||
| 807 | + method=responses.PATCH, | ||
| 808 | + url=url, | ||
| 809 | + status=204, | ||
| 810 | + match=helpers.MATCH_EMPTY_QUERY_PARAMS, | ||
| 811 | + ) | ||
| 812 | + | ||
| 813 | + result = gl.http_patch("/projects") | ||
| 814 | + assert isinstance(result, requests.Response) | ||
| 815 | + assert responses.assert_call_count(url, 1) is True | ||
| 816 | + | ||
| 817 | + | ||
| 803 | 818 | @responses.activate | |
| 804 | 819 | def test_patch_request_404(gl): | |
| 805 | 820 | url = "http://localhost/api/v4/not_there" | |
| Back | FazBrowse Home | New Git URL |
0 commit comments