mirror of
https://github.com/caddyserver/caddy.git
synced 2025-06-04 11:14:42 +08:00
Added the Context to the browse directive
Moved the Context type to middleware and exported it. Users can use .Include and others in browse directive templating Created test for the templates directive.
This commit is contained in:
@ -31,7 +31,7 @@ func (t Templates) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error
|
||||
for _, ext := range rule.Extensions {
|
||||
if reqExt == ext {
|
||||
// Create execution context
|
||||
ctx := context{root: t.FileSys, req: r, URL: r.URL}
|
||||
ctx := middleware.Context{Root: t.FileSys, Req: r, URL: r.URL}
|
||||
|
||||
// Build the template
|
||||
tpl, err := template.ParseFiles(filepath.Join(t.Root, fpath))
|
||||
|
Reference in New Issue
Block a user