From 65427ee38e3a80e6ed117d704871b59f5e661a63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Thu, 21 Apr 2022 18:30:54 +0200 Subject: [PATCH] Manager: use `e.NoContent(http.StatusNoContent)` to return "no content" No functional changes, just the right call for the job. --- internal/manager/api_impl/jobs.go | 4 ++-- internal/manager/api_impl/workers.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/manager/api_impl/jobs.go b/internal/manager/api_impl/jobs.go index fb6916e9..5005f21d 100644 --- a/internal/manager/api_impl/jobs.go +++ b/internal/manager/api_impl/jobs.go @@ -153,7 +153,7 @@ func (f *Flamenco) SetJobStatus(e echo.Context, jobID string) error { logger.Error().Err(err).Msg("error changing job status") return sendAPIError(e, http.StatusInternalServerError, "unexpected error changing job status") } - return e.String(http.StatusNoContent, "") + return e.NoContent(http.StatusNoContent) } func (f *Flamenco) TaskUpdate(e echo.Context, taskID string) error { @@ -199,7 +199,7 @@ func (f *Flamenco) TaskUpdate(e echo.Context, taskID string) error { return sendAPIError(e, http.StatusInternalServerError, "unable to handle status update: %v", err) } - return e.String(http.StatusNoContent, "") + return e.NoContent(http.StatusNoContent) } func (f *Flamenco) doTaskUpdate( diff --git a/internal/manager/api_impl/workers.go b/internal/manager/api_impl/workers.go index 64138ce9..79b8e18a 100644 --- a/internal/manager/api_impl/workers.go +++ b/internal/manager/api_impl/workers.go @@ -156,7 +156,7 @@ func (f *Flamenco) SignOff(e echo.Context) error { return sendAPIError(e, http.StatusInternalServerError, "error re-queueing your tasks") } - return e.String(http.StatusNoContent, "") + return e.NoContent(http.StatusNoContent) } // workerRequeueActiveTasks re-queues all active tasks (should be max one) of this worker. @@ -190,7 +190,7 @@ func (f *Flamenco) WorkerState(e echo.Context) error { worker := requestWorkerOrPanic(e) if worker.StatusRequested == "" { - return e.String(http.StatusNoContent, "") + return e.NoContent(http.StatusNoContent) } return e.JSON(http.StatusOK, api.WorkerStateChange{ @@ -236,7 +236,7 @@ func (f *Flamenco) WorkerStateChanged(e echo.Context) error { return sendAPIError(e, http.StatusInternalServerError, "error storing worker in database") } - return e.String(http.StatusNoContent, "") + return e.NoContent(http.StatusNoContent) } func (f *Flamenco) ScheduleTask(e echo.Context) error { @@ -275,7 +275,7 @@ func (f *Flamenco) ScheduleTask(e echo.Context) error { return sendAPIError(e, http.StatusInternalServerError, "internal error finding a task for you: %v", err) } if dbTask == nil { - return e.String(http.StatusNoContent, "") + return e.NoContent(http.StatusNoContent) } // Convert database objects to API objects: