make splitURL public
This commit is contained in:
parent
1b4922693b
commit
c32b038da2
|
@ -2,8 +2,8 @@ package config
|
|||
|
||||
import "strings"
|
||||
|
||||
// splits an URL without empty sets
|
||||
func splitURL(url string) []string {
|
||||
// SplitURL without empty sets
|
||||
func SplitURL(url string) []string {
|
||||
trimmed := strings.Trim(url, " /\t\r\n")
|
||||
split := strings.Split(trimmed, "/")
|
||||
|
||||
|
|
|
@ -55,8 +55,8 @@ func (server *Server) collide() error {
|
|||
continue
|
||||
}
|
||||
|
||||
aParts := splitURL(aService.Pattern)
|
||||
bParts := splitURL(bService.Pattern)
|
||||
aParts := SplitURL(aService.Pattern)
|
||||
bParts := SplitURL(bService.Pattern)
|
||||
|
||||
// not same size
|
||||
if len(aParts) != len(bParts) {
|
||||
|
|
|
@ -54,7 +54,7 @@ func (svc *Service) checkPattern() error {
|
|||
}
|
||||
|
||||
// for each slash-separated chunk
|
||||
parts := splitURL(svc.Pattern)
|
||||
parts := SplitURL(svc.Pattern)
|
||||
for i, part := range parts {
|
||||
if len(part) < 1 {
|
||||
return ErrInvalidPattern
|
||||
|
@ -154,8 +154,8 @@ func (svc *Service) checkAndFormatInput(types []datatype.T) error {
|
|||
|
||||
// checks if an uri matches the service's pattern
|
||||
func (svc *Service) matchPattern(uri string) bool {
|
||||
uriparts := splitURL(uri)
|
||||
parts := splitURL(svc.Pattern)
|
||||
uriparts := SplitURL(uri)
|
||||
parts := SplitURL(svc.Pattern)
|
||||
|
||||
// fail if size differ
|
||||
if len(uriparts) != len(parts) {
|
||||
|
|
|
@ -45,9 +45,3 @@ type BraceCapture struct {
|
|||
Index int
|
||||
Ref *Parameter
|
||||
}
|
||||
|
||||
// links to the related URI parameter and hold a value
|
||||
type braceCaptureValue struct {
|
||||
BraceCapture
|
||||
Value interface{}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue