summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2019-07-05 13:59:30 -0600
committerMatthew Holt <mholt@users.noreply.github.com>2019-07-05 13:59:30 -0600
commit84f9f7cd606146f1a1d6717d369fc98509365de6 (patch)
tree2f76062f080421a91a724251ea3c4df871465fe3 /modules
parent79216d356c728522542154c294a4ae6b9c8d2c26 (diff)
Little cleanups
Diffstat (limited to 'modules')
-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) {