diff options
Diffstat (limited to 'middleware/path.go')
-rw-r--r-- | middleware/path.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/middleware/path.go b/middleware/path.go new file mode 100644 index 000000000..1ffb64b76 --- /dev/null +++ b/middleware/path.go @@ -0,0 +1,18 @@ +package middleware + +import "strings" + + +// TODO(miek): matches for names. + +// Path represents a URI path, maybe with pattern characters. +type Path string + +// Matches checks to see if other matches p. +// +// Path matching will probably not always be a direct +// comparison; this method assures that paths can be +// easily and consistently matched. +func (p Path) Matches(other string) bool { + return strings.HasPrefix(string(p), other) +} |