summaryrefslogtreecommitdiff
path: root/modules/caddyhttp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/caddyhttp')
-rw-r--r--modules/caddyhttp/routes.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/modules/caddyhttp/routes.go b/modules/caddyhttp/routes.go
index 0882be6..5e61fae 100644
--- a/modules/caddyhttp/routes.go
+++ b/modules/caddyhttp/routes.go
@@ -39,6 +39,18 @@ type ServerRoute struct {
responder Handler
}
+// Empty returns true if the route has all zero/default values.
+func (sr ServerRoute) Empty() bool {
+ return len(sr.MatcherSets) == 0 &&
+ len(sr.Apply) == 0 &&
+ len(sr.Respond) == 0 &&
+ len(sr.matcherSets) == 0 &&
+ len(sr.middleware) == 0 &&
+ sr.responder == nil &&
+ !sr.Terminal &&
+ sr.Group == ""
+}
+
func (sr ServerRoute) anyMatcherSetMatches(r *http.Request) bool {
for _, ms := range sr.matcherSets {
if ms.Match(r) {