Skip to content

Commit

Permalink
add slash
Browse files Browse the repository at this point in the history
  • Loading branch information
xgdgsc committed Aug 22, 2022
1 parent bfed9b4 commit 7706bf2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 7706bf2

Please sign in to comment.