Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Don't post data if no arguments were passed. #85

Merged
merged 2 commits into from Mar 14, 2022

Conversation

amartinunowhy
Copy link
Contributor

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.

@rbeuque74 rbeuque74 self-assigned this Feb 27, 2020
@DidelotK
Copy link

Any news about this issues ?

@sdiemer
Copy link

sdiemer commented Jun 4, 2021

Hello,
I'm experiencing the same issue on /cloud/project/{}/user/{}/s3Credentials.
@rbeuque74 Any news on a possible date for a fix ?
Regards

ovh/client.py Outdated Show resolved Hide resolved
@sdiemer
Copy link

sdiemer commented Jan 24, 2022

Hello,

Any news on this issue ?

Regards

sdiemer added a commit to UbiCastTeam/python-ovh that referenced this pull request Jan 24, 2022
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.
…ovided

Signed-off-by: Romain Beuque <556072+rbeuque74@users.noreply.github.com>
@rbeuque74
Copy link
Member

rbeuque74 commented Mar 14, 2022

Hello @sdiemer ,
Sorry for the lag on my side.
I changed a bit your proposal, looks good to me.

Thanks for your contribution ! 💯

@rbeuque74 rbeuque74 merged commit 159cf51 into ovh:master Mar 14, 2022
@rbeuque74 rbeuque74 added this to the v1.0.0 milestone Mar 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants