From 701c809180b2717e64bc7b67a6aadd4e4a9bbd99 Mon Sep 17 00:00:00 2001 From: Paul Hallett Date: Wed, 25 Sep 2024 09:07:53 +0100 Subject: [PATCH] Add patch method to generated clients --- .python-version | 1 + CHANGELOG.md | 4 ++++ tests/test_client/http.py | 8 ++++++++ 3 files changed, 13 insertions(+) create mode 100644 .python-version diff --git a/.python-version b/.python-version new file mode 100644 index 0000000..2419ad5 --- /dev/null +++ b/.python-version @@ -0,0 +1 @@ +3.11.9 diff --git a/CHANGELOG.md b/CHANGELOG.md index 9757b60..ee9b0cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change log +## 0.9.0 + +- Support `patch` methods + ## 0.8.3 - Fix bug with headers assignment diff --git a/tests/test_client/http.py b/tests/test_client/http.py index 1e95808..b83a2bd 100644 --- a/tests/test_client/http.py +++ b/tests/test_client/http.py @@ -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: