From f4eb1c7b2b93f2a53f8b41bc8e32253ed2fd6438 Mon Sep 17 00:00:00 2001 From: Ben Morrison Date: Mon, 20 May 2019 20:57:07 -0400 Subject: removing check for zero bytes written to http.ResponseWriter - handling later case-by-case --- handlers.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'handlers.go') diff --git a/handlers.go b/handlers.go index 7cf3ad2..9a2a7c6 100644 --- a/handlers.go +++ b/handlers.go @@ -56,8 +56,8 @@ func apiBaseHandler(w http.ResponseWriter, r *http.Request) { pathdata := []byte("\n\n" + r.URL.Path) timerfc3339 = append(timerfc3339, pathdata...) - n, err := w.Write(timerfc3339) - if err != nil || n == 0 { + _, err = w.Write(timerfc3339) + if err != nil { log500(w, r, err) return } @@ -74,8 +74,8 @@ func apiFormatHandler(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", txtutf8) - n, err := w.Write([]byte(format + "\n")) - if err != nil || n == 0 { + _, err := w.Write([]byte(format + "\n")) + if err != nil { log500(w, r, err) return } @@ -104,8 +104,8 @@ func apiEndpointHandler(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", htmlutf8) - n, err := w.Write([]byte(r.URL.String())) - if err != nil || n == 0 { + _, err = w.Write([]byte(r.URL.String())) + if err != nil { log500(w, r, err) return } @@ -139,8 +139,8 @@ func apiTagsBaseHandler(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", htmlutf8) - n, err := w.Write([]byte("api/" + format + "/tags")) - if err != nil || n == 0 { + _, err := w.Write([]byte("api/" + format + "/tags")) + if err != nil { log500(w, r, err) return } -- cgit 1.4.1-2-gfad0