Skip to content

Request body missing in OnResponse handler due to RoundTripper consumption #28

@trco

Description

@trco

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?

I need the request body within the OnResponse handler, and currently, I'm passing it through session.SetProp here. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions