Skip to content

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

Merged
rbeuque74 merged 2 commits intoovh:masterfrom
amartinunowhy:fix/empty-post-error
Mar 14, 2022
Merged

fix: Don't post data if no arguments were passed.#85
rbeuque74 merged 2 commits intoovh:masterfrom
amartinunowhy:fix/empty-post-error

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

@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.
@rbeuque74 rbeuque74 force-pushed the fix/empty-post-error branch from 74f23e1 to 5cfac4b Compare March 14, 2022 16:12
…ovided

Signed-off-by: Romain Beuque <556072+rbeuque74@users.noreply.github.com>
@rbeuque74 rbeuque74 force-pushed the fix/empty-post-error branch from cae3541 to 2b1cde9 Compare March 14, 2022 16:42
@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.

4 participants