caddy/middleware/path.go

16 lines
398 B
Go
Raw Normal View History

2015-01-30 06:08:40 +01:00
package middleware
import "strings"
// Path represents a URI path, maybe with pattern characters.
type Path string
2015-05-25 04:52:34 +02:00
// Matches checks to see if other matches p.
//
2015-01-30 06:08:40 +01:00
// Path matching will probably not always be a direct
// comparison; this method assures that paths can be
2015-04-18 17:54:35 +02:00
// easily and consistently matched.
2015-01-30 06:08:40 +01:00
func (p Path) Matches(other string) bool {
return strings.HasPrefix(string(p), other)
}