Merge pull request #3792 from hashicorp/issue-3791

Fixes crash where body was optional for PQ endpoint (it is not).
This commit is contained in:
James Phillips 2018-01-10 09:43:59 -08:00 committed by GitHub
commit 9dd1a70844
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 6 deletions

View File

@ -16,6 +16,7 @@ IMPROVEMENTS:
BUG FIXES:
* server: Fixed a crash when POST-ing an empty body to the /v1/query endpoint. [[GH-3791](https://github.com/hashicorp/consul/issues/3791)]
* ui: Added a URI escape around key/value keys so that it's not possible to create unexpected partial key names when entering characters like `?` inside a key. [[GH-3760](https://github.com/hashicorp/consul/issues/3760)]
## 1.0.2 (December 15, 2017)

View File

@ -22,12 +22,10 @@ func (s *HTTPServer) preparedQueryCreate(resp http.ResponseWriter, req *http.Req
}
s.parseDC(req, &args.Datacenter)
s.parseToken(req, &args.Token)
if req.ContentLength > 0 {
if err := decodeBody(req, &args.Query, nil); err != nil {
resp.WriteHeader(http.StatusBadRequest)
fmt.Fprintf(resp, "Request decode failed: %v", err)
return nil, nil
}
if err := decodeBody(req, &args.Query, nil); err != nil {
resp.WriteHeader(http.StatusBadRequest)
fmt.Fprintf(resp, "Request decode failed: %v", err)
return nil, nil
}
var reply string