From 48cfe6ff5f0ffbd588b8837446c191491fb3fde2 Mon Sep 17 00:00:00 2001 From: James Phillips Date: Wed, 10 Jan 2018 09:33:49 -0800 Subject: [PATCH] Fixes crash where body was optional for PQ endpoint (it is not). Fixes #3791 --- agent/prepared_query_endpoint.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/agent/prepared_query_endpoint.go b/agent/prepared_query_endpoint.go index 1d8ee7ba27..0be0ea3ed9 100644 --- a/agent/prepared_query_endpoint.go +++ b/agent/prepared_query_endpoint.go @@ -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