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

Accepting request via api with integer value in survey #537

Closed
mr-falken opened this issue Sep 19, 2022 · 1 comment · Fixed by #539
Closed

Accepting request via api with integer value in survey #537

mr-falken opened this issue Sep 19, 2022 · 1 comment · Fixed by #539

Comments

@mr-falken
Copy link

mr-falken commented Sep 19, 2022

Hi,
this is related to this comment to another issue: I'm pasting everything again here for convenience.

SQuest is running at latest stable version (v1.7.5)

My survey is a simple json like this (please note number without double quotes):

{
  "delete": 2
}

The survey is filled correctly when requesting the resource via squest UI.

When I POST (via curl or python) the accept method indicating the survey, the number gets converted as a string

{
  "delete": "2"
}

This brings the process operation to fail with a 'NoneType' object has no attribute 'id' - not triggered if I correct the json survey by hand and remove double quotes.

The curl to post the accept method is like this :

curl -X POST "https://[...]/api/service_catalog/request/233/accept/" -d '{ "delete": 2 }' -H 'Content-Type: application/json' -H "accept: application/json" -H "authorization: Bearer [...]"

Same result when posting via python:

headers = { "Authorization": "Bearer [...]", 
            "Accept": "application/json",
            "Content-Type": "application/json" }

d = { 'delete': 2 }

endpoint = "https://[...]/api/service_catalog/request/233/accept/"
response = requests.post(endpoint, data=json.dumps(d), headers=headers)

As stated, after posting the accept method if I inspect the request's survey via API or UI the value has been converted to string.

I saw a MR accepted in dev a few days ago, but I didn't understand if that's related to this bug.

@EliasBoulharts EliasBoulharts linked a pull request Sep 23, 2022 that will close this issue
@Sispheor
Copy link
Contributor

Done, fixed and merged in dev branch

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 a pull request may close this issue.

2 participants