returnnil,h.Errf("parsing caddyfile tokens for '%s': %v",dir,err)
returnnil,h.Errf("parsing caddyfile tokens for '%s': %v",dir,err)
}
}
for_,result:=rangeresults{
for_,result:=rangeresults{
handler,ok:=result.Value.(caddyhttp.Route)
switchhandler:=result.Value.(type){
if!ok{
casecaddyhttp.Route:
returnnil,h.Errf("%s directive returned something other than an HTTP route: %#v (only handler directives can be used in routes)",dir,result.Value)
sr.Routes=append(sr.Routes,handler)
casecaddyhttp.Subroute:
// directives which return a literal subroute instead of a route
// means they intend to keep those handlers together without
// them being reordered; we're doing that anyway since we're in
// the route directive, so just append its handlers
sr.Routes=append(sr.Routes,handler.Routes...)
default:
returnnil,h.Errf("%s directive returned something other than an HTTP route or subroute: %#v (only handler directives can be used in routes)",dir,result.Value)