mirror of https://github.com/status-im/consul.git
Fixes crash where body was optional for PQ endpoint (it is not).
Fixes #3791
This commit is contained in:
parent
6c3cce19fa
commit
48cfe6ff5f
|
@ -22,13 +22,11 @@ func (s *HTTPServer) preparedQueryCreate(resp http.ResponseWriter, req *http.Req
|
||||||
}
|
}
|
||||||
s.parseDC(req, &args.Datacenter)
|
s.parseDC(req, &args.Datacenter)
|
||||||
s.parseToken(req, &args.Token)
|
s.parseToken(req, &args.Token)
|
||||||
if req.ContentLength > 0 {
|
|
||||||
if err := decodeBody(req, &args.Query, nil); err != nil {
|
if err := decodeBody(req, &args.Query, nil); err != nil {
|
||||||
resp.WriteHeader(http.StatusBadRequest)
|
resp.WriteHeader(http.StatusBadRequest)
|
||||||
fmt.Fprintf(resp, "Request decode failed: %v", err)
|
fmt.Fprintf(resp, "Request decode failed: %v", err)
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var reply string
|
var reply string
|
||||||
if err := s.agent.RPC("PreparedQuery.Apply", &args, &reply); err != nil {
|
if err := s.agent.RPC("PreparedQuery.Apply", &args, &reply); err != nil {
|
||||||
|
|
Loading…
Reference in New Issue