ambiguous status codes makes it difficult to reason about api errors
- Dominant language
- Go
- Stars
- 30.1k
- Forks
- 4.6k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 43
Description
When filing a bug, please include the following headings if possible. Any example text in this template can be deleted.
#### Overview of the Issue
When calling the API to POST a prepared query, it returns 500 if it already exists. The correct would be to return 409 Conflict.
The body message makes it clear that the query already has been created but the 500 return code is less than ideal.
Not only it's semantically wrong but it also makes it harder to reason with in automated logic as 5xx is reserved for Server Errors.
#### Reproduction Steps
1. Call
```bash
curl http://127.0.0.1:8500/v1/query \
--request POST \
--data \
'{
"Name": "test",
"Service": {
"Service": "test",
"Failover": {
"NearestN": 2
}
}
}'
```
2. Then call it again.
Contributor guide
Assessment
This issue has not been assessed yet.