mirror of
https://github.com/yusing/godoxy.git
synced 2026-03-31 06:03:06 +02:00
fixed json access logger
This commit is contained in:
@@ -41,7 +41,7 @@ func processMap[V any](cfg *FieldConfig, m map[string]V, redactedV V) map[string
|
||||
return m
|
||||
}
|
||||
|
||||
newMap := make(map[string]V)
|
||||
newMap := make(map[string]V, len(m))
|
||||
for k := range m {
|
||||
var mode FieldMode
|
||||
var ok bool
|
||||
|
||||
@@ -123,6 +123,11 @@ func (f JSONFormatter) Format(line *bytes.Buffer, req *http.Request, res *http.R
|
||||
entry.Error = res.Status
|
||||
}
|
||||
|
||||
if entry.ContentType != "" {
|
||||
// try to get content type from request
|
||||
entry.ContentType = req.Header.Get("Content-Type")
|
||||
}
|
||||
|
||||
marshaller := json.NewEncoder(line)
|
||||
err := marshaller.Encode(entry)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user