slack-io / slacker

Slack Bot Framework
MIT License
32 stars 9 forks source link

Ability to set context in middleware & capture responses #16

Closed Gobd closed 4 days ago

Gobd commented 4 days ago

Fixes #12

Done in the same way as http.Request WithContext https://cs.opensource.google/go/go/+/refs/tags/go1.22.4:src/net/http/request.go;l=353

raed-shomali commented 4 days ago

Thank you!

trajan0x commented 3 days ago

Sorry, maybe I'm missing something here. Does this address response capture?

Gobd commented 3 days ago

This should allow you to do

ctx := context.WithValue(cmdCtx.Context(), "test", "value")
cmdCtx = cmdCtx.WithContext(ctx)

to store any value you want in the context then access it in the next handler.

raed-shomali commented 3 days ago

Might be nice to create an example of this for future users in the examples folder