Manager: use e.NoContent(http.StatusNoContent) to return "no content"

No functional changes, just the right call for the job.
This commit is contained in:
Sybren A. Stüvel 2022-04-21 18:30:54 +02:00
parent d0e96ad7bd
commit 65427ee38e
2 changed files with 6 additions and 6 deletions

View File

@ -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(

View File

@ -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: