proceedUnmodified

Available in a dev version: 0․11․0-grpc-186

How to configure

open suspend fun FlowCollector<Response>.proceedUnmodified(request: Flow<Request>)(source)

Convenience for flow builders: proceeds with request and emits the resulting response elements into this FlowCollector. Useful inside flow {} blocks within interceptors.

val myAuthInterceptor = object : GrpcServerInterceptor {
override fun <Request, Response> GrpcServerCallScope<Request, Response>.intercept(
request: Flow<Request>,
): Flow<Response> =
flow {
val authorized = mySuspendAuth(requestHeaders)
if (!authorized) {
close(GrpcStatus(GrpcStatusCode.PERMISSION_DENIED, "Not authorized"))
}

proceedUnmodified(request)
}
}