Fixes crash where body was optional for PQ endpoint (it is not).

Fixes #3791
This commit is contained in:
James Phillips 2018-01-10 09:33:49 -08:00
parent 8da3e8288b
commit e282e9285c
No known key found for this signature in database
GPG Key ID: 77183E682AC5FC11
1 changed files with 4 additions and 6 deletions

View File

@ -22,13 +22,11 @@ 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
}
}
var reply string
if err := s.agent.RPC("PreparedQuery.Apply", &args, &reply); err != nil {