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

Invalid calls to POST …/scale return JSON parse errors #8236

Open
backspace opened this issue Jun 22, 2020 · 0 comments
Open

Invalid calls to POST …/scale return JSON parse errors #8236

backspace opened this issue Jun 22, 2020 · 0 comments
Labels
theme/api HTTP API and SDK issues type/bug

Comments

@backspace
Copy link
Contributor

While reviewing #8207, I thought I’d manipulate the calls to POST /v1/job/:job/scale to see what would happen if I passed invalid Count values.

With "Count":1.5 the response was:

json: cannot unmarshal number 1.5 into Go struct field ScalingRequest.Count of type int64

With "Count":"xyz" the response was:

json: cannot unmarshal string into Go struct field ScalingRequest.Count of type int64

Both of these responses came with HTTP status 400.

Example cURL
curl 'http://localhost:4300/v1/job/api/scale' \                                  
  -H 'content-type: application/json; charset=UTF-8' \
  --data-binary '{"Count":"xyz","Reason":"Manual scaling event from the Nomad UI","Target":{"Group":"endpoints"},"Meta":{"Source":"nomad-ui"}}' \

It would be nice from an API consumer perspective for these responses to come as JSON, perhaps status 422?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme/api HTTP API and SDK issues type/bug
Projects
None yet
Development

No branches or pull requests

1 participant