-
Notifications
You must be signed in to change notification settings - Fork 347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dump如何拿到完整的请求和响应报文? #363
Comments
在请求级别设置dump resp, err := client.R().EnableDump().Get(url)
...
content := resp.Dump()
... |
后续会考虑在client级别加上吗? 在请求级别加我要加的地方太多了 |
是指每个请求都写到不同文件吗?如果是client级别, 目前就是所有的请求都会写到同一个文件 |
是在client级别需要一个类似resp.Dump()的api。我目前在client通过EnableDumpAllTo设置了io.Writer,但是内部每次调用Write方法时传递的并不是完整的报文。我希望每次调用Write方法时都是完整的报文,这样我才好处理日志。 |
是想单次write调用时写入完整报文是吧, 这个应该实现不了。 c := req.C().OnAfterResponse(func(client *req.Client, resp *req.Response) error {
dump := resp.Dump()
...
}) |
感谢,忘记中间件这回事了 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
我在client设置了EnableDumpAllTo,我需要将每个请求完整的报文输出到指定的地方。但是目前测试的情况是按行来进行写入的,请问一下该怎么设置才能在每次写入时获得完整的报文?
The text was updated successfully, but these errors were encountered: