mirror of
https://github.com/weloe/token-go.git
synced 2025-10-08 08:50:10 +08:00
feat: add UrlNoQuery(), used to return url without query param
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user