From 79112ce342467f64644b88e7904b4a1c496d6759 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Fri, 19 Aug 2016 11:51:12 +0100 Subject: [PATCH] close #16 --- directory/file.go | 6 +++++- page/page.go | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/directory/file.go b/directory/file.go index 03cadf02..726116c8 100644 --- a/directory/file.go +++ b/directory/file.go @@ -233,7 +233,11 @@ func (i *Info) serveListing(w http.ResponseWriter, r *http.Request, c *config.Co } w.Header().Set("Content-Type", "application/json; charset=utf-8") - return w.Write(marsh) + if _, err := w.Write(marsh); err != nil { + return http.StatusInternalServerError, err + } + + return http.StatusOK, nil } page := &p.Page{ diff --git a/page/page.go b/page/page.go index 265f834a..21ae4804 100644 --- a/page/page.go +++ b/page/page.go @@ -134,5 +134,9 @@ func (p Page) PrintAsJSON(w http.ResponseWriter) (int, error) { } w.Header().Set("Content-Type", "application/json; charset=utf-8") - return w.Write(marsh) + if _, err := w.Write(marsh); err != nil { + return http.StatusInternalServerError, err + } + + return http.StatusOK, nil }