Skip to content

Commit

Permalink
CE service impl. using Fprint with writer, instead of direct writer c…
Browse files Browse the repository at this point in the history
…all (#65)

💫 Using Fprint with writer, instead of direct writer call

Signed-off-by: Matthias Wessendorf <[email protected]>
  • Loading branch information
matzew authored Mar 26, 2024
1 parent 0e13c39 commit 22391b7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cloudevents/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,11 @@ func (s *Service) Ready(w http.ResponseWriter, r *http.Request) {
message := "error checking readiness"
log.Debug().Err(err).Msg(message)
w.WriteHeader(500)
_, _ = w.Write([]byte(message + ". " + err.Error()))
fmt.Fprint(w, "error checking readiness: ", err.Error())
return
}
if !ready {
message := "function not yet available"
message := "function not yet ready"
log.Debug().Msg(message)
w.WriteHeader(503)
fmt.Fprintln(w, message)
Expand All @@ -201,11 +201,11 @@ func (s *Service) Alive(w http.ResponseWriter, r *http.Request) {
message := "error checking liveness"
log.Err(err).Msg(message)
w.WriteHeader(500)
_, _ = w.Write([]byte(message + ". " + err.Error()))
fmt.Fprint(w, "error checking liveness: ", err.Error())
return
}
if !alive {
message := "function not ready"
message := "function not alive"
log.Debug().Msg(message)
w.WriteHeader(503)
_, _ = w.Write([]byte(message))
Expand Down

0 comments on commit 22391b7

Please sign in to comment.