diff options
author | Ben Morrison <ben@gbmor.dev> | 2019-05-20 20:57:07 -0400 |
---|---|---|
committer | Ben Morrison <ben@gbmor.dev> | 2019-05-20 20:59:36 -0400 |
commit | f4eb1c7b2b93f2a53f8b41bc8e32253ed2fd6438 (patch) | |
tree | 3e894186f9c5d4d29438313c066c21f915054979 | |
parent | ef0ee9137ee5cedf5327fa9908e88c155c49ae8f (diff) | |
download | getwtxt-f4eb1c7b2b93f2a53f8b41bc8e32253ed2fd6438.tar.gz |
removing check for zero bytes written to http.ResponseWriter - handling later case-by-case
-rw-r--r-- | handlers.go | 16 |
1 files changed, 8 insertions, 8 deletions
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 } |