Commit 676202a3 authored by Carter's avatar Carter

Fixed styling and byte count

parent 8e8e2f59
...@@ -147,17 +147,16 @@ func NewReplacer(r *http.Request, rr *ResponseRecorder, emptyValue string) Repla ...@@ -147,17 +147,16 @@ func NewReplacer(r *http.Request, rr *ResponseRecorder, emptyValue string) Repla
return rep return rep
} }
func canLogRequest(r *http.Request) (canLog bool) { func canLogRequest(r *http.Request) bool {
if r.Method == "POST" || r.Method == "PUT" { if r.Method == "POST" || r.Method == "PUT" {
for _, cType := range r.Header[headerContentType] { for _, cType := range r.Header[headerContentType] {
// the cType could have charset and other info // the cType could have charset and other info
if strings.Index(cType, contentTypeJSON) > -1 || strings.Index(cType, contentTypeXML) > -1 { if strings.Index(cType, contentTypeJSON) > -1 || strings.Index(cType, contentTypeXML) > -1 {
canLog = true return true
break
} }
} }
} }
return return false
} }
// readRequestBody reads the request body and sets a // readRequestBody reads the request body and sets a
...@@ -280,5 +279,5 @@ const ( ...@@ -280,5 +279,5 @@ const (
headerContentType = "Content-Type" headerContentType = "Content-Type"
contentTypeJSON = "application/json" contentTypeJSON = "application/json"
contentTypeXML = "application/xml" contentTypeXML = "application/xml"
maxLogBodySize = 100 * 1000 maxLogBodySize = 100 * 1024
) )
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment