From 6363a3b289c3e5ee4fe8f4295e25965276b0da8b Mon Sep 17 00:00:00 2001 From: Sven Grossmann Date: Thu, 29 Jul 2021 17:24:54 +0200 Subject: [PATCH] added logging of postdata --- main.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index c415095..3dfe328 100644 --- a/main.go +++ b/main.go @@ -333,6 +333,11 @@ func makeListener(ctx context.Context, requestURL string, opts options) func(int return } + body := "none" + if ev.Request.HasPostData { + body = ev.Request.PostData + } + err := chromedp.Run( ctx, chromedp.ActionFunc(func(ctx context.Context) error { @@ -357,7 +362,7 @@ func makeListener(ctx context.Context, requestURL string, opts options) func(int } // Log the request - fmt.Printf("%s %s %d %s\n", ev.Request.Method, ev.Request.URL, ev.ResponseStatusCode, contentType) + fmt.Printf("%s %s %d %s %s\n", ev.Request.Method, ev.Request.URL, ev.ResponseStatusCode, strings.ReplaceAll(contentType, " ", ""), url.QueryEscape(body)) // replace spaces for easier awk return nil }),