Skip to content

Commit

Permalink
Add patch method to generated clients
Browse files Browse the repository at this point in the history
  • Loading branch information
phalt committed Sep 25, 2024
1 parent 7a0ce8b commit 701c809
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.11.9
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change log

## 0.9.0

- Support `patch` methods

## 0.8.3

- Fix bug with headers assignment
Expand Down
8 changes: 8 additions & 0 deletions tests/test_client/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,14 @@ def put(url: str, data: dict, headers: typing.Optional[dict] = None) -> httpx.Re
return client.put(parse_url(url), json=json_data, headers=client_headers)


def patch(url: str, data: dict, headers: typing.Optional[dict] = None) -> httpx.Response:
"""Issue an HTTP PATCH request"""
if headers:
client_headers.update(headers)
json_data = json.loads(json.dumps(data, default=json_serializer))
return client.patch(parse_url(url), json=json_data, headers=client_headers)


def delete(url: str, headers: typing.Optional[dict] = None) -> httpx.Response:
"""Issue an HTTP DELETE request"""
if headers:
Expand Down

0 comments on commit 701c809

Please sign in to comment.