fixed code smells: string literal repetition + cyclomatic complexity

This commit is contained in:
A.Unger committed 2021-11-17 12:25:21 +01:00
1 parent c567eb6eea
commit aa4112e2e2
7 files changed
+95 -98

No files matched your search

+4 -2
View File
@@ -27,10 +27,12 @@ func Server(opts ...Option) (*http.Server, error) {
), nil
}
const contentTypeHeader = "Content-Type"
// health implements the health check.
func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) {
return func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/plain")
w.Header().Set(contentTypeHeader, "text/plain")
w.WriteHeader(http.StatusOK)
// TODO(tboerger): check if services are up and running
@@ -44,7 +46,7 @@ func health(cfg *config.Config) func(http.ResponseWriter, *http.Request) {
// ready implements the ready check.
func ready(cfg *config.Config) func(http.ResponseWriter, *http.Request) {
return func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/plain")
w.Header().Set(contentTypeHeader, "text/plain")
w.WriteHeader(http.StatusOK)
// TODO(tboerger): check if services are up and running