mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-04 04:04:00 +00:00
rpc: fix inappropriate http request log (#7244)
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httputil"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"strings"
|
||||
@@ -36,7 +37,7 @@ func makeHTTPHandler(rpcFunc *RPCFunc, logger log.Logger) func(http.ResponseWrit
|
||||
|
||||
// All other endpoints
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
logger.Debug("HTTP HANDLER", "req", r)
|
||||
logger.Debug("HTTP HANDLER", "req", dumpHTTPRequest(r))
|
||||
|
||||
ctx := &rpctypes.Context{HTTPReq: r}
|
||||
args := []reflect.Value{reflect.ValueOf(ctx)}
|
||||
@@ -232,3 +233,12 @@ func getParam(r *http.Request, param string) string {
|
||||
}
|
||||
return s
|
||||
}
|
||||
|
||||
func dumpHTTPRequest(r *http.Request) string {
|
||||
d, e := httputil.DumpRequest(r, true)
|
||||
if e != nil {
|
||||
return e.Error()
|
||||
}
|
||||
|
||||
return string(d)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user