only write METHOD PATH | BODY if $DEBUG=true
This commit is contained in:
8
main.go
8
main.go
@@ -62,9 +62,11 @@ func newHandler(cfg Config) http.HandlerFunc {
|
||||
mux.Handle("POST /api/v1/events/slack", http.HandlerFunc(newHandlerPostAPIV1EventsSlack(cfg)))
|
||||
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
b, _ := io.ReadAll(r.Body)
|
||||
r.Body = io.NopCloser(bytes.NewReader(b))
|
||||
log.Printf("%s %s | %s", r.Method, r.URL, b)
|
||||
if cfg.Debug {
|
||||
b, _ := io.ReadAll(r.Body)
|
||||
r.Body = io.NopCloser(bytes.NewReader(b))
|
||||
log.Printf("%s %s | %s", r.Method, r.URL, b)
|
||||
}
|
||||
|
||||
mux.ServeHTTP(w, r)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user