Skip to content
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

Get the request body without consuming it before sending to upstream #191

Closed
pengye91 opened this issue Apr 8, 2024 · 3 comments
Closed
Assignees
Labels
enhancement New feature or request WIP We are working on this feature internally

Comments

@pengye91
Copy link

pengye91 commented Apr 8, 2024

What is the problem your feature solves, or the need it fulfills?

currently we can't get the request body in any methods without consuming it.

we can use read_request_body() method on the session but it will consume the body causing the upstream get a None for the request body, which is not we wanted.

I think this is a common case for a proxy, for example, to log the request body.

Describe the solution you'd like

I'd like to get the request body in the request_filter or upstream_request_filter phase without consuming it.

@drcaramelsyrup drcaramelsyrup added the enhancement New feature or request label Apr 9, 2024
@drcaramelsyrup
Copy link
Contributor

I imagine we should have a request_body_filter like response_body_filter to be able to handle this.

@christianscano
Copy link

Nowadays, is there a momentary solution to read the request body without consuming it?

@eaufavor eaufavor self-assigned this May 14, 2024
@eaufavor eaufavor added the WIP We are working on this feature internally label May 14, 2024
@drcaramelsyrup
Copy link
Contributor

Note that request_body_filter was added in f38f3b9 which should allow inspecting (or mutating) the body just before sending it to the upstream.

This should fit your mentioned use case of logging the request body, so I will close, but feel free to reopen or open a new issue if you have another use case in mind. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request WIP We are working on this feature internally
Projects
None yet
Development

No branches or pull requests

4 participants