mirror of
https://codeberg.org/scip/esctl.git
synced 2026-08-24 13:54:17 +02:00
fix http debugger
This commit is contained in:
@@ -246,8 +246,11 @@ type DebugTransport struct {
|
||||
}
|
||||
|
||||
func (t *DebugTransport) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||
buf := new(bytes.Buffer)
|
||||
content := ""
|
||||
contentline := ""
|
||||
|
||||
if req.ContentLength > 0 {
|
||||
buf := new(bytes.Buffer)
|
||||
body, _ := req.GetBody()
|
||||
|
||||
_, err := buf.ReadFrom(body)
|
||||
@@ -261,7 +264,11 @@ func (t *DebugTransport) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||
return nil, fmt.Errorf("json parse error: %s", err)
|
||||
}
|
||||
|
||||
slog.Info("req", "host", req.URL.Host, "uri", req.URL.Path, "body", pretty.String(), "bodyline", buf.String())
|
||||
content = pretty.String()
|
||||
contentline = buf.String()
|
||||
}
|
||||
|
||||
slog.Info("req", "host", req.URL.Host, "uri", req.URL.Path, "body", content, "bodyline", contentline)
|
||||
|
||||
return t.Transport.RoundTrip(req)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user