You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
489 B
26 lines
489 B
2 months ago
|
package requestbuilder
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"wss-pool/pkg/model"
|
||
|
)
|
||
|
|
||
|
type PublicUrlBuilder struct {
|
||
|
host string
|
||
|
}
|
||
|
|
||
|
func (p *PublicUrlBuilder) Init(host string) *PublicUrlBuilder {
|
||
|
p.host = host
|
||
|
return p
|
||
|
}
|
||
|
|
||
|
func (p *PublicUrlBuilder) Build(path string, request *model.GetRequest) string {
|
||
|
if request != nil {
|
||
|
result := fmt.Sprintf("https://%s%s?%s", p.host, path, request.BuildParams())
|
||
|
return result
|
||
|
} else {
|
||
|
result := fmt.Sprintf("https://%s%s", p.host, path)
|
||
|
return result
|
||
|
}
|
||
|
}
|