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

Function TemplateParam

coderd/httpmw/templateparam.go:17–23  ·  view source on GitHub ↗

TemplateParam returns the template from the ExtractTemplateParam handler.

(r *http.Request)

Source from the content-addressed store, hash-verified

15
16// TemplateParam returns the template from the ExtractTemplateParam handler.
17func 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.
26func ExtractTemplateParam(db database.Store) func(http.Handler) http.Handler {

Callers 13

templateMethod · 0.92
deleteTemplateMethod · 0.92
patchTemplateMetaMethod · 0.92
templateDAUsMethod · 0.92
templateVersionByNameMethod · 0.92
TestTemplateParamFunction · 0.92
templateACLMethod · 0.92
patchTemplateACLMethod · 0.92

Calls 2

ContextMethod · 0.65
ValueMethod · 0.45

Tested by 1

TestTemplateParamFunction · 0.74