summaryrefslogtreecommitdiff
path: root/example/example.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2024-02-05 01:07:44 +0700
committerShulhan <ms@kilabit.info>2024-02-05 03:22:09 +0700
commita36a4a365b30ff4f331f5b9e5e08b5c98257aff5 (patch)
tree349d6e2b9c0bffe99b7d3d81a4acb55887dfa281 /example/example.go
parent30bbaec568592dbe8e23fa56068d4df06be90753 (diff)
downloadgorankusu-a36a4a365b30ff4f331f5b9e5e08b5c98257aff5.tar.xz
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.
Diffstat (limited to 'example/example.go')
-rw-r--r--example/example.go8
1 files changed, 4 insertions, 4 deletions
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
}