Merge pull request #48 from xgdgsc/patch-1

add slash
This commit is contained in:
Soren L. Hansen
2022-08-26 23:34:23 -07:00
committed by GitHub

View File

@@ -111,7 +111,12 @@ func (server *Server) Run(ctx context.Context, options ...RunOption) error {
if server.options.EnableRandomUrl {
path = "/" + randomstring.Generate(server.options.RandomUrlLength) + "/"
}
if !strings.HasPrefix(path, "/") {
path = "/" + path
}
if !strings.HasSuffix(path, "/") {
path = path + "/"
}
handlers := server.setupHandlers(cctx, cancel, path, counter)
srv, err := server.setupHTTPServer(handlers)
if err != nil {