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

Commit3cda8ee

Browse files
committed
fix(client): handle empty 204 reponses in PUT requests
1 parent70959e8 commit3cda8ee

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

‎gitlab/client.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,6 +1061,8 @@ def http_put(
10611061
raw=raw,
10621062
**kwargs,
10631063
)
1064+
ifresult.status_codeingitlab.const.NO_JSON_RESPONSE_CODES:
1065+
returnresult
10641066
try:
10651067
json_result=result.json()
10661068
ifTYPE_CHECKING:

‎tests/unit/test_gitlab_http_methods.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,21 @@ def test_put_request_404(gl):
766766
assertresponses.assert_call_count(url,1)isTrue
767767

768768

769+
@responses.activate
770+
deftest_patch_request_204(gl):
771+
url="http://localhost/api/v4/projects"
772+
responses.add(
773+
method=responses.PUT,
774+
url=url,
775+
status=204,
776+
match=helpers.MATCH_EMPTY_QUERY_PARAMS,
777+
)
778+
779+
result=gl.http_put("/projects")
780+
assertisinstance(result,requests.Response)
781+
assertresponses.assert_call_count(url,1)isTrue
782+
783+
769784
@responses.activate
770785
deftest_put_request_invalid_data(gl):
771786
url="http://localhost/api/v4/projects"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp