|
@@ -3,6 +3,7 @@ package rest
|
|
|
import (
|
|
|
"git.nspix.com/golang/micro/gateway/http"
|
|
|
"gorm.io/gorm"
|
|
|
+ "strings"
|
|
|
)
|
|
|
|
|
|
type Options struct {
|
|
@@ -17,6 +18,9 @@ type Option func(o *Options)
|
|
|
|
|
|
func WithPrefix(prefix string) Option {
|
|
|
return func(o *Options) {
|
|
|
+ if !strings.HasPrefix(prefix, "/") {
|
|
|
+ prefix = "/" + prefix
|
|
|
+ }
|
|
|
o.Prefix = prefix
|
|
|
}
|
|
|
}
|