// HandleListJobs responds with an array of all Jobs within the server, // active or disabled. func HandleListJobsRequest(cache job.JobCache) func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) { resp := &ListJobsResponse{ Jobs: cache.GetAll(), } w.Header().Set(contentType, jsonContentType) w.WriteHeader(http.StatusOK) if err := json.NewEncoder(w).Encode(resp); err != nil { log.Error("Error occured when marshalling response: %s", err) return } } }