code: func (s *HTTPServer) AgentCheckUpdate(resp http.ResponseWriter, req *http.Request) (interface{}, error) {
  	var update checkUpdate
  	if err := decodeBody(req, &update, nil); err != nil {
  		resp.WriteHeader(http.StatusBadRequest)
  		fmt.Fprintf(resp, "Request decode failed: %v", err)
  		return nil, nil
  	}
  
  	switch update.Status {
  	case api.HealthPassing:
  	case api.HealthWarning:
  	case api.HealthCritical:
  	default:
  		resp.WriteHeader(http.StatusBadRequest)
  		fmt.Fprintf(resp, "Invalid check status: '%s'", update.Status)
  		return nil, nil
  	}
  
  	total := len(update.Output)
  	if total > checks.BufSize {
  		update.Output = fmt.Sprintf("%s ... (captured %d of %d bytes)",
  			update.Output[:checks.BufSize], checks.BufSize, total)
  	}
  
  	checkID := types.CheckID(strings.TrimPrefix(req.URL.Path, "/v1/agent/check/update/"))
  
  	// Get the provided token, if any, and vet against any ACL policies.
  	var token string
  	s.parseToken(req, &token)
  	if err := s.agent.vetCheckUpdate(token, checkID); err != nil {
  		return nil, err
  	}
  
  	if err := s.agent.updateTTLCheck(checkID, update.Status, update.Output); err != nil {
  		return nil, err
  	}
  	s.syncChanges()
  	return nil, nil
  }
docs: // AgentCheckUpdate is a PUT-based alternative to the GET-based Pass/Warn/Fail
  // APIs.