-
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
Add POST /query endpoint and warning messages for using GET with write operations #6390
Conversation
72a62f8
to
ceb69c5
Compare
@@ -148,13 +151,13 @@ func (e *QueryExecutor) Close() error { | |||
} | |||
|
|||
// ExecuteQuery executes each statement within a query. | |||
func (e *QueryExecutor) ExecuteQuery(query *Query, database string, chunkSize int, closing chan struct{}) <-chan *Result { | |||
func (e *QueryExecutor) ExecuteQuery(query *Query, database string, chunkSize int, readonly bool, closing chan struct{}) <-chan *Result { |
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.
Signature is getting lot of parameters (6 now). May want to refactor this in another PR.
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.
I agree. Most of this stuff is included in ExecutionContext
so that can probably just be used. We're going to have to change this at some point to include the user, so I'll change it then.
@jsternberg Sending parameters on the URL is somewhat unusual for a You could achieve this by doing something like: // client/influxdb.go
// don't add the values to u.RawQuery, then:
body := strings.NewReader(values.Encode())
req, err := http.NewRequest("POST", u.String(), body)
... Then, in the q := r.URL.Query()
pretty := q.Get("pretty") == "true" we should be doing: pretty := r.FormValue.Get("pretty") == "true" which will support request that come in both via |
@e-dard you're right, but we do the same thing with |
ceb69c5
to
b439c86
Compare
@jsternberg why would they need to be treated differently? |
I just read the full of what you wrote and I'm likely wrong. I'll modify and try it out. This is why skim reading isn't a real thing. |
b439c86
to
321914f
Compare
@e-dard updated, but credentials still have to be in the query url since the code for that one is shared with |
7c2137d
to
86cfe40
Compare
URL parameters with POST is perfectly acceptable. It allows setting parameters and a payload separately. It also means the payload can be something other than URL-encoded parameters. We do this for |
LGTM 👍 |
…e operations In order to follow REST a bit more carefully, all write operations should go through a POST in the future. We still allow read operations through either GET or POST (similar to the Graphite /render endpoint), but write operations will trigger a returned warning as part of the JSON response and will eventually return an error. Also updates the Golang client libraries to always use POST instead of GET. Fixes #6290.
86cfe40
to
6f61c0e
Compare
In order to follow REST a bit more carefully, all write operations
should go through a POST in the future. We still allow read operations
through either GET or POST (similar to the Graphite /render endpoint),
but write operations will trigger a returned warning as part of the JSON
response and will eventually return an error.
Fixes #6290.