mirror of
https://github.com/yusing/godoxy.git
synced 2026-03-19 07:54:48 +01:00
preparing for v0.5
This commit is contained in:
15
src/proxy/fields/path.go
Normal file
15
src/proxy/fields/path.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package fields
|
||||
|
||||
import (
|
||||
E "github.com/yusing/go-proxy/error"
|
||||
F "github.com/yusing/go-proxy/utils/functional"
|
||||
)
|
||||
|
||||
type Path struct{ F.Stringable }
|
||||
|
||||
func NewPath(s string) (Path, E.NestedError) {
|
||||
if s == "" || s[0] == '/' {
|
||||
return Path{F.NewStringable(s)}, E.Nil()
|
||||
}
|
||||
return Path{}, E.Invalid("path", s).Extra("must be empty or start with '/'")
|
||||
}
|
||||
Reference in New Issue
Block a user