Skip to content

Commit

Permalink
Merge pull request #3792 from hashicorp/issue-3791
Browse files Browse the repository at this point in the history
 Fixes crash where body was optional for PQ endpoint (it is not).
  • Loading branch information
slackpad authored Jan 10, 2018
2 parents 6c3cce1 + 10b4eaf commit 9dd1a70
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 4 additions & 6 deletions agent/prepared_query_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9dd1a70

Please sign in to comment.