Right now, command middleware is pretty limited because:
It can not capture the responses in any way. Traditionally, in an http middleware I could do something like this:
return func(handler slacker.CommandHandler) slacker.CommandHandler {
return func(cmdCtx *slacker.CommandContext) {
ctx := context.WithValue(cmdCtx.Context(), "test", "value")
// in gin this would be c.Request.WithContext (or c.WithContext in net/http
cmdCtx.WithContext(ctx)
next()
// within the next method I could query this context
}
}
There's nothing like that at all. For an example use case, you could do thing s like otel with this. I've put together an example here w/o the context pass down
It would also be very standard to be able to capture the response after next() is called.
This could either be done by overwriting the writer, or with a hook on reply
Ability to inherit context in middleware
Right now, command middleware is pretty limited because:
There's nothing like that at all. For an example use case, you could do thing s like otel with this. I've put together an example here w/o the context pass down
It would also be very standard to be able to capture the response after next() is called.
This could either be done by overwriting the writer, or with a hook on reply