ChatParam returns the chat from the ExtractChatParam handler.
(r *http.Request)
| 13 | |
| 14 | // ChatParam returns the chat from the ExtractChatParam handler. |
| 15 | func ChatParam(r *http.Request) database.Chat { |
| 16 | chat, ok := r.Context().Value(chatParamContextKey{}).(database.Chat) |
| 17 | if !ok { |
| 18 | panic("developer error: chat param middleware not provided") |
| 19 | } |
| 20 | return chat |
| 21 | } |
| 22 | |
| 23 | // ExtractChatParam grabs a chat from the "chat" URL parameter. |
| 24 | func ExtractChatParam(db database.Store) func(http.Handler) http.Handler { |