You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have two (similar) idea to implement this feature.
The first idea, which draws inspiration from Rust's tonic, is to define gRPC Request type to carry extra data and generated method signature becomes t: Request[T].
trait Request[T] {
def message: T
def headers: Headers // For accuracy, we should us e grpc MetadataMap type instead of http.Headers
def attributes: Vault
}
// ...
def unaryToUnary[F[_]: Temporal, A, B](
decode: Decoder[A],
encode: Encoder[B],
serviceName: String,
methodName: String,
)( // Stuff we apply at invocation
- f: (A, Headers) => F[B]+. f: (Request[A]) => F[B]
): HttpRoutes[F] = HttpRoutes.of[F] {
The second idea is to just add Vault type to f arguments.
Current method signature:
(t:T, ctx: Headers)
lacks ability to get attributes from outside.Imagine when you implement an auth interceptor that put a user id to request's attributes, how can you get the user id in service implementation?
I have two (similar) idea to implement this feature.
The first idea, which draws inspiration from Rust's tonic, is to define gRPC Request type to carry extra data and generated method signature becomes
t: Request[T]
.The second idea is to just add
Vault
type tof
arguments.The text was updated successfully, but these errors were encountered: