MCPcopy Index your code
hub / github.com/coder/coder / TemplateVersionParam

Function TemplateVersionParam

coderd/httpmw/templateversionparam.go:19–25  ·  view source on GitHub ↗

TemplateVersionParam returns the template version from the ExtractTemplateVersionParam handler.

(r *http.Request)

Source from the content-addressed store, hash-verified

17
18// TemplateVersionParam returns the template version from the ExtractTemplateVersionParam handler.
19func 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.
28func ExtractTemplateVersionParam(db database.Store) func(http.Handler) http.Handler {

Calls 2

ContextMethod · 0.65
ValueMethod · 0.45

Tested by 1

TestTemplateVersionParamFunction · 0.74