I need to get access to the underlying http4s Request here:
val endpoint =
sseEndpoint
.mapOut[fs2.Stream[F, OUTPUT]](_ => throw new NotImplementedError("this should never be invoked"))(stream =>
registry.register(
StreamRegistry.StreamName.fromEndpoint("SSE: ", e),
// GET DETAILS FROM REQUEST
details = None,
pipe(stream)
// It seems that no logging is done if the stream fails, so we need to do it ourselves
.onFinalizeCase {
case ExitCase.Succeeded => onStreamError.onSucceeded(e)
case ExitCase.Canceled => onStreamError.onCancelled(e)
case ExitCase.Errored(err) => onStreamError.onError(e, err)
}(using onStreamError.applicative),
)
)
That could be achieved using either extractFromRequest
or contextIn
, however, I don’t see a way to pass this information from the inputs to the output mapper.
Is there a way?