diff options
author | Ethel Morgan <eth@ethulhu.co.uk> | 2020-07-07 22:11:01 +0100 |
---|---|---|
committer | Ethel Morgan <eth@ethulhu.co.uk> | 2020-07-07 22:11:01 +0100 |
commit | bad6e92e8450d9c70db55e507a4488770a10f89a (patch) | |
tree | 9b807a29f4d625311eb4617e493bed85d4009801 | |
parent | acbd480721aafbfc2c7dc923da4bc9f6db585ad0 (diff) |
-rw-r--r-- | logger.go | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -24,6 +24,11 @@ func (rw *responseWriter) WriteHeader(code int) { rw.ResponseWriter.WriteHeader(code) } +const ( + kb = 1024 + mb = 1024 * kb +) + // Logger is a middleware for logging HTTP requests and responses, using go.eth.moe/logger. func Logger(next http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { @@ -47,6 +52,10 @@ func Logger(next http.Handler) http.Handler { } log.AddField(fmt.Sprintf("http.query.%s", k), vs) } + + if err := r.ParseMultipartForm(10 * mb); err != nil { + log.WithError(err).Error("could not parse request form") + } for k, vs := range r.Form { if len(vs) == 1 { log.AddField(fmt.Sprintf("http.form.%s", k), vs[0]) |