-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Require parameter for query endpoint #1975
Conversation
39e9e27
to
4cb5fbb
Compare
@@ -5,6 +5,7 @@ | |||
|
|||
### Bugfixes | |||
- [#1971](https://github.com/influxdb/influxdb/pull/1971): Fix leader id initialization. | |||
- [#1975](https://github.com/influxdb/influxdb/pull/1975): Require parameter for query endpoint. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a bit more precise. Which parameter after all? "Require 'q' parameter for query endpoint" perhaps?
pretty := q.Get("pretty") == "true" | ||
|
||
qp := strings.TrimSpace(q.Get("q")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why use TrimSpace
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because a user can send in a parameter of q=+
which is just a space which will result in the parser still returning ok. While not exactly the same error, the result is you really didn't give me a query parameter, so it needs to return an error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice.
Makes sense, 1 question. +1 |
Require parameter for query endpoint
There was a bug where if you issued a curl command like this and accidentally sent the wrong params (double encoded) and as a result, didn't send the
q
parameter, the endpoint would return 200 ok with an empty json result, instead of an error:It now correctly returns this: