-
Notifications
You must be signed in to change notification settings - Fork 1k
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
feat(web): Relax GrpcWebService request body type #2016
base: master
Are you sure you want to change the base?
Conversation
@@ -113,7 +116,7 @@ where | |||
debug!(kind = "other h2", content_type = ?req.headers().get(header::CONTENT_TYPE)); | |||
ResponseFuture { | |||
case: Case::Other { | |||
future: self.inner.call(req), | |||
future: self.inner.call(req.map(tonic::body::boxed)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, if we have to box the request no matter what, what are we gaining with this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The benefit is the CorsGrpcWeb
can handle any kind of body types which has the trait bounds.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While the change itself seems fine, I'm still left with the thought: should we avoid all of the constraints that require a service that accepts Request<BoxBody>
?
It seems like if we're going to bother to be totally generic over the request body type in GrpcWebService
, we should also do so in CorsWebLayer
? Maybe there's a very obvious reason why we can't, but looking at tower_http::cors::Cors
shows that it's also generic over the request body... so it feels like we should be able to?
Since I assume your main question is whether we can avoid requiring a I guess so too. When I was working on this, I was also looking into the implementation of |
cfcbc7b
to
4be6fc0
Compare
Relaxes
GrpcWebService
's request body type.