From b3a0d0c9c07894cc35e1d4b23820d7172149a3b3 Mon Sep 17 00:00:00 2001 From: Gisle Aune Date: Sat, 12 Aug 2017 08:17:36 +0200 Subject: [PATCH] Use response.Text in Resource's handler --- resource.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/resource.go b/resource.go index b2112df..0f76a94 100644 --- a/resource.go +++ b/resource.go @@ -36,9 +36,7 @@ func (resource *Resource) Handle(path string, w http.ResponseWriter, req *http.R // Error out on bad IDs which contains /es if x := strings.Index(subpath, "/"); x != -1 { - w.Header().Set("Content-Type", "text/plain; charset=utf-8") - w.WriteHeader(400) - w.Write([]byte("Invalid ID: " + subpath)) + response.Text(w, 400, "Invalid ID: "+subpath) return true }