From a36a4a365b30ff4f331f5b9e5e08b5c98257aff5 Mon Sep 17 00:00:00 2001 From: Shulhan Date: Mon, 5 Feb 2024 01:07:44 +0700 Subject: all: add type to customize how to dump HTTP request and response The HTTPRequestDumper define an handler to convert [http.Request] into [RunResponse] DumpRequest. The HTTPResponseDumper define an handler to convert [http.Response] into [RunResponse] DumpResponse. --- example/example.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'example/example.go') diff --git a/example/example.go b/example/example.go index 128c78c..17e24eb 100644 --- a/example/example.go +++ b/example/example.go @@ -460,7 +460,7 @@ func (ex *Example) runExampleGet(req *trunks.RunRequest) (res *trunks.RunRespons return nil, err } - err = res.SetHTTPRequest(httpRequest) + err = res.SetHTTPRequest(req.HTTPTarget.RequestDumper, httpRequest) if err != nil { return nil, err } @@ -472,7 +472,7 @@ func (ex *Example) runExampleGet(req *trunks.RunRequest) (res *trunks.RunRespons return nil, err } - err = res.SetHTTPResponse(httpResponse) + err = res.SetHTTPResponse(req.HTTPTarget.ResponseDumper, httpResponse) if err != nil { return nil, err } @@ -553,7 +553,7 @@ func (ex *Example) runExamplePostForm(req *trunks.RunRequest) (res *trunks.RunRe return nil, err } - err = res.SetHTTPRequest(httpRequest) + err = res.SetHTTPRequest(req.HTTPTarget.RequestDumper, httpRequest) if err != nil { return nil, err } @@ -563,7 +563,7 @@ func (ex *Example) runExamplePostForm(req *trunks.RunRequest) (res *trunks.RunRe return nil, err } - err = res.SetHTTPResponse(httpResponse) + err = res.SetHTTPResponse(req.HTTPTarget.ResponseDumper, httpResponse) if err != nil { return nil, err } -- cgit v1.3