Browse Source

Use response.Text in Resource's handler

master
Gisle Aune 7 years ago
parent
commit
b3a0d0c9c0
  1. 4
      resource.go

4
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 // Error out on bad IDs which contains /es
if x := strings.Index(subpath, "/"); x != -1 { 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 return true
} }

Loading…
Cancel
Save