mirror of
https://github.com/tendermint/tendermint.git
synced 2026-01-07 05:46:32 +00:00
rpc: fix inappropriate http request log (#7244)
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"net/http/httputil"
|
||||||
"reflect"
|
"reflect"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -36,7 +37,7 @@ func makeHTTPHandler(rpcFunc *RPCFunc, logger log.Logger) func(http.ResponseWrit
|
|||||||
|
|
||||||
// All other endpoints
|
// All other endpoints
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
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}
|
ctx := &rpctypes.Context{HTTPReq: r}
|
||||||
args := []reflect.Value{reflect.ValueOf(ctx)}
|
args := []reflect.Value{reflect.ValueOf(ctx)}
|
||||||
@@ -232,3 +233,12 @@ func getParam(r *http.Request, param string) string {
|
|||||||
}
|
}
|
||||||
return s
|
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