feat: add UrlNoQuery(), used to return url without query param

This commit is contained in:
weloe
2023-06-06 03:35:21 +08:00
parent e270c268dc
commit f5939dce57
3 changed files with 23 additions and 1 deletions

View File

@@ -39,6 +39,19 @@ func (d *HttpRequest) Url() string {
return d.source.URL.String()
}
func (d *HttpRequest) UrlNoQuery() string {
var scheme string
if d.source.URL.Scheme != "" {
scheme = d.source.URL.Scheme
}
if d.source.TLS != nil {
scheme = "https"
} else {
scheme = "http"
}
return scheme + "://" + d.source.Host + d.source.URL.Path
}
func (d *HttpRequest) Method() string {
return d.source.Method
}