http: validating job is provided to avoid nil pointer

This commit is contained in:
Armon Dadgar
2015-09-20 17:38:26 -07:00
parent 798c8791fd
commit 2c3febc8af

View File

@@ -160,6 +160,9 @@ func (s *HTTPServer) jobUpdate(resp http.ResponseWriter, req *http.Request,
if err := decodeBody(req, &args, nil); err != nil {
return nil, CodedError(400, err.Error())
}
if args.Job == nil {
return nil, CodedError(400, "Job must be specified")
}
if jobName != "" && args.Job.ID != jobName {
return nil, CodedError(400, "Job ID does not match")
}