TemplateParam returns the template from the ExtractTemplateParam handler.
(r *http.Request)
| 15 | |
| 16 | // TemplateParam returns the template from the ExtractTemplateParam handler. |
| 17 | func TemplateParam(r *http.Request) database.Template { |
| 18 | template, ok := r.Context().Value(templateParamContextKey{}).(database.Template) |
| 19 | if !ok { |
| 20 | panic("developer error: template param middleware not provided") |
| 21 | } |
| 22 | return template |
| 23 | } |
| 24 | |
| 25 | // ExtractTemplateParam grabs a template from the "template" URL parameter. |
| 26 | func ExtractTemplateParam(db database.Store) func(http.Handler) http.Handler { |