Remove superfluous response.WriteHeader call

as the Write of the responseWriter automatically sends also the Header.
This commit is contained in:
Maximilian Paß
2022-08-17 13:21:37 +02:00
parent f2b25566dd
commit c7ee7c1e25

View File

@ -100,6 +100,7 @@ func (r *RunnerController) fileContent(writer http.ResponseWriter, request *http
targetRunner, _ := runner.FromContext(request.Context()) targetRunner, _ := runner.FromContext(request.Context())
path := request.URL.Query().Get(PathKey) path := request.URL.Query().Get(PathKey)
writer.Header().Set("Content-Type", "application/octet-stream")
err := targetRunner.GetFileContent(path, writer, request.Context()) err := targetRunner.GetFileContent(path, writer, request.Context())
if errors.Is(err, runner.ErrFileNotFound) { if errors.Is(err, runner.ErrFileNotFound) {
writeNotFound(writer, err) writeNotFound(writer, err)
@ -109,9 +110,6 @@ func (r *RunnerController) fileContent(writer http.ResponseWriter, request *http
writeInternalServerError(writer, err, dto.ErrorUnknown) writeInternalServerError(writer, err, dto.ErrorUnknown)
return return
} }
writer.Header().Set("Content-Type", "application/octet-stream")
writer.WriteHeader(http.StatusOK)
} }
// execute handles the execute API route. // execute handles the execute API route.