diff options
| author | John L. Villalovos <john@sodarock.com> | 2023-03-04 14:45:24 -0800 |
|---|---|---|
| committer | Nejc Habjan <hab.nejc@gmail.com> | 2023-03-12 11:11:49 +0100 |
| commit | f2b5e4fa375e88d6102a8d023ae2fe8206042545 (patch) | |
| tree | a0e2f4667d6dc5fe76353c2c36ff7c4b689b707a /gitlab/client.py | |
| parent | d387d91401fdf933b1832ea2593614ea6b7d8acf (diff) | |
| download | gitlab-f2b5e4fa375e88d6102a8d023ae2fe8206042545.tar.gz | |
chore: use a dataclass to return values from `prepare_send_data`
I found the tuple of three values confusing. So instead use a
dataclass to return the three values. It is still confusing but a
little bit less so.
Also add some unit tests
Diffstat (limited to 'gitlab/client.py')
| -rw-r--r-- | gitlab/client.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/gitlab/client.py b/gitlab/client.py index c3982f3..495ed44 100644 --- a/gitlab/client.py +++ b/gitlab/client.py @@ -716,10 +716,8 @@ class Gitlab: retry_transient_errors = self.retry_transient_errors # We need to deal with json vs. data when uploading files - json, data, content_type = self._backend.prepare_send_data( - files, post_data, raw - ) - opts["headers"]["Content-type"] = content_type + send_data = self._backend.prepare_send_data(files, post_data, raw) + opts["headers"]["Content-type"] = send_data.content_type cur_retries = 0 while True: @@ -727,8 +725,8 @@ class Gitlab: result = self._backend.http_request( method=verb, url=url, - json=json, - data=data, + json=send_data.json, + data=send_data.data, params=params, timeout=timeout, verify=verify, |
