hyperium / tonic

A native gRPC client & server implementation with async/await support.
https://docs.rs/tonic
MIT License
9.99k stars 1.01k forks source link

Make tonic-web layer generic over request/response body #1361

Open bouk opened 1 year ago

bouk commented 1 year ago

Feature Request

Right now the tonic_web layer requires that the upstream service returns a http::Response<BoxBody> and it only accepts http::Request<hyper::Body>. It could be made generic over the request/response body so it could be used in more contexts—for example you could implement the tonic-web layer as a reverse proxy.

Motivation

I want to proxy a Python gRPC service with tonic-web. The lack of flexibility means I can't just stick tonic-web in front of a hyper::Client to proxy the upstream.

LucioFranco commented 1 year ago

I would be ok if we can add this in a way that makes sense.

bouk commented 1 year ago

I have a PR here: https://github.com/hyperium/tonic/pull/1366