TemplateVersionParam returns the template version from the ExtractTemplateVersionParam handler.
(r *http.Request)
| 17 | |
| 18 | // TemplateVersionParam returns the template version from the ExtractTemplateVersionParam handler. |
| 19 | func TemplateVersionParam(r *http.Request) database.TemplateVersion { |
| 20 | templateVersion, ok := r.Context().Value(templateVersionParamContextKey{}).(database.TemplateVersion) |
| 21 | if !ok { |
| 22 | panic("developer error: template version param middleware not provided") |
| 23 | } |
| 24 | return templateVersion |
| 25 | } |
| 26 | |
| 27 | // ExtractTemplateVersionParam grabs template version from the "templateversion" URL parameter. |
| 28 | func ExtractTemplateVersionParam(db database.Store) func(http.Handler) http.Handler { |