blob: 985261493358cae31b2f34c8d192faed39838c46 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
package request
import "net/url"
type requestURL struct {
httpURL *url.URL
urlString string
parameters map[string]string
}
// EncodeURL add and encoded parameters.
func (ru *requestURL) EncodeURL() (err error) {
ru.httpURL, err = url.Parse(ru.urlString)
if err != nil {
return err
}
query := ru.httpURL.Query()
for k := range ru.parameters {
query.Set(k, ru.parameters[k])
}
ru.httpURL.RawQuery = query.Encode()
return err
}
// String return example: https://www.google.com/search?a=1&b=2
func (ru requestURL) string() string {
return ru.httpURL.String()
}
func (ru requestURL) scheme() string {
return ru.httpURL.Scheme
}
func (ru requestURL) host() string {
return ru.httpURL.Host
}
|