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

bad request when voting on review #8

Closed
drakaru opened this issue Aug 23, 2021 · 5 comments
Closed

bad request when voting on review #8

drakaru opened this issue Aug 23, 2021 · 5 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@drakaru
Copy link

drakaru commented Aug 23, 2021

Since the change from form data to json in 0.6.3 swarm responds 400 on vote.

If I revert the change in 0.6.3 to send form data instead, it works fine.

https://www.perforce.com/manuals/swarm/Content/Swarm/swarm-apidoc_endpoint_reviews.html#Set_vote_for_the_authenticated_user_to_up,_down,_or_cleared

Note I am using SWARM/2019.3/1886340 (2019/11/20) however the current docs don't mention json either.

@pbelskiy pbelskiy added good first issue Good for newcomers bug Something isn't working labels Aug 23, 2021
@pbelskiy
Copy link
Owner

pbelskiy commented Aug 23, 2021

Thanks for report, will check it soon

@drakaru are you using sync client?

@pbelskiy
Copy link
Owner

pbelskiy commented Aug 23, 2021

It is strange, because even in old Swarm version (2017) docs says that it`s possible to put parameters as json in POST body - https://www.perforce.com/manuals/v17.4/swarm/#Swarm/swarm-apidoc.html

Used data instead of json for:

  • reviews.vote()
  • comments.add() (add check for topic)

@drakaru
Copy link
Author

drakaru commented Aug 23, 2021

Interesting. I'm not sure.

Here's a small code sample to show all I'm doing:
I'm using api ver 9.

swarm_client = SwarmClient(
    f"{swarm_host}/api/v{swarm_api_ver}",
    swarm_api_user,
    swarm_api_ticket,
    verify=False,
)

swarm_client.reviews.vote(review_id, "up")

@pbelskiy
Copy link
Owner

@drakaru

Fixed in https://github.com/pbelskiy/helix-swarm/releases/tag/v0.6.4

@drakaru
Copy link
Author

drakaru commented Aug 26, 2021

Grabbed latest and confirmed working here, thanks!

@drakaru drakaru closed this as completed Aug 26, 2021
pbelskiy added a commit that referenced this issue Apr 13, 2022
1) json= was used because of this:
#7

2) then many data= were changed to json= and we got:
#8

3) some were reverted, but also json= is not work for
#14

So it's seems more stable approach to use data= everywhere except
first issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants