1
0
Fork 0
forked from External/mediamtx
mediamtx/internal/protocols/httpserv/location_with_trailing_slash.go

12 lines
270 B
Go

package httpserv
import "net/url"
// LocationWithTrailingSlash returns the URL in a relative format, with a trailing slash.
func LocationWithTrailingSlash(u *url.URL) string {
l := "./" + u.Path[1:] + "/"
if u.RawQuery != "" {
l += "?" + u.RawQuery
}
return l
}