adds request log to txt/json endpoints removes un-necessary debug log
This commit is contained in:
@@ -125,6 +125,9 @@ func webRoot(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func webJSON(w http.ResponseWriter, r *http.Request) {
|
||||
httpAccessLog(r)
|
||||
crossSiteOrigin(w)
|
||||
|
||||
if strings.ToLower(r.Method) != "get" {
|
||||
config.Cfg.Log.Debug("http invalid method", "url", r.URL.Path, "expected", "GET", "received", r.Method)
|
||||
tmpltError(w, http.StatusBadRequest, "Invalid http method.")
|
||||
@@ -155,6 +158,9 @@ func webJSON(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func webTXT(w http.ResponseWriter, r *http.Request) {
|
||||
httpAccessLog(r)
|
||||
crossSiteOrigin(w)
|
||||
|
||||
if strings.ToLower(r.Method) != "get" {
|
||||
config.Cfg.Log.Debug("http invalid method", "url", r.URL.Path, "expected", "GET", "received", r.Method)
|
||||
tmpltError(w, http.StatusBadRequest, "Invalid http method.")
|
||||
|
@@ -147,5 +147,6 @@ func tmpltTXT(w http.ResponseWriter) {
|
||||
return
|
||||
}
|
||||
|
||||
w.Header().Add("Content-Type", TYPE_TEXT_PLAIN)
|
||||
w.Write(msgBuffer.Bytes()) //nolint:errcheck
|
||||
}
|
||||
|
Reference in New Issue
Block a user