Skip to content

Commit

Permalink
Fixes crash where body was optional for PQ endpoint (it is not).
Browse files Browse the repository at this point in the history
Fixes #3791
  • Loading branch information
slackpad committed Jan 10, 2018
1 parent 6c3cce1 commit 48cfe6f
Showing 1 changed file with 4 additions and 6 deletions.
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 48cfe6f

Please sign in to comment.