AdguardTeam / AdguardTeam/gomitmproxy

Request body missing in OnResponse handler due to RoundTripper consumption

Đang mở
#28 0 bình luận 1 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Go
Star
344
Fork
71
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Using RoundTripper results in the request body being consumed, which means that the request retrieved with `session.Request()` in the OnResponse handler is without a body. I understand that this is how RoundTripper works in Go.

Would it be reasonable to set the consumed body back to the request within gomitmproxy at this [point](https://github.com/AdguardTeam/gomitmproxy/blob/master/proxy.go#L292)?

I need the request body within the OnResponse handler, and currently, I'm passing it through `session.SetProp` [here](https://github.com/trco/wannabe/blob/9a7c27592839d4b4448054fa1df051c1cdd0af55/handlers/wannabe_on_request.go#L73). This approach seems wrong, as I would expect the request body to be available in the OnResponse handler. However, I may be missing a reason why your code doesn't set the request body back to the request.

If you find it reasonable to add the body back to the request after RoundTripper consumes it, I'm ready to prepare a PR.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.