Skip to content

Commit 5cfac4b

Browse files
amartinunowhyrbeuque74
authored andcommitted
fix: Don't post data if no arguments were passed.
There have been some changes in the production API that make any POST call without arguments to fail with the following error: `You provided an input body while none was expected` This is in particular the case in the `cloud/project/{}/kube/{}/kubeconfig` call. The `kwargs` arguments to the upstream call is passed as `data` to `raw_call()`. A check for `None` is done to prevent adding a body. This condition is never true as in the case of no arguments, `data` is not `None` but contains an empty dict. In this case, loosy testing for _falsiness_ is better.
1 parent 478eb50 commit 5cfac4b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ovh/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ def raw_call(self, method, path, data=None, need_auth=True):
494494
}
495495

496496
# include payload
497-
if data is not None:
497+
if data:
498498
headers['Content-type'] = 'application/json'
499499
body = json.dumps(data)
500500

0 commit comments

Comments
 (0)