Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite15349c

Browse files
nejchJohnVillalovos
authored andcommitted
fix(client): support empty 204 responses in http_patch
1 parentff45124 commite15349c

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

‎gitlab/client.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,6 +1083,8 @@ def http_patch(
10831083
raw=raw,
10841084
**kwargs,
10851085
)
1086+
ifresult.status_codeingitlab.const.NO_JSON_RESPONSE_CODES:
1087+
returnresult
10861088
try:
10871089
json_result=result.json()
10881090
ifTYPE_CHECKING:

‎gitlab/const.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ class SearchScope(GitlabEnum):
9595

9696
USER_AGENT:str=f"{__title__}/{__version__}"
9797

98+
NO_JSON_RESPONSE_CODES= [204]
9899
RETRYABLE_TRANSIENT_ERROR_CODES= [500,502,503,504]+list(range(520,531))
99100

100101
__all__= [

‎tests/unit/test_gitlab_http_methods.py‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -800,6 +800,21 @@ def test_patch_request(gl):
800800
assertresponses.assert_call_count(url,1)isTrue
801801

802802

803+
@responses.activate
804+
deftest_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+
assertisinstance(result,requests.Response)
815+
assertresponses.assert_call_count(url,1)isTrue
816+
817+
803818
@responses.activate
804819
deftest_patch_request_404(gl):
805820
url="http://localhost/api/v4/not_there"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp