Fix var name url to u

This commit is contained in:
178inaba 2017-04-15 04:36:27 +09:00
parent 5d72d54344
commit c63f290928
3 changed files with 12 additions and 12 deletions

View file

@ -24,14 +24,14 @@ type Client struct {
}
func (c *Client) doAPI(method string, uri string, params url.Values, res interface{}) error {
url, err := url.Parse(c.config.Server)
u, err := url.Parse(c.config.Server)
if err != nil {
return err
}
url.Path = path.Join(url.Path, uri)
u.Path = path.Join(u.Path, uri)
var resp *http.Response
req, err := http.NewRequest(method, url.String(), strings.NewReader(params.Encode()))
req, err := http.NewRequest(method, u.String(), strings.NewReader(params.Encode()))
if err != nil {
return err
}
@ -70,13 +70,13 @@ func (c *Client) Authenticate(username, password string) error {
params.Set("password", password)
params.Set("scope", "read write follow")
url, err := url.Parse(c.config.Server)
u, err := url.Parse(c.config.Server)
if err != nil {
return err
}
url.Path = path.Join(url.Path, "/oauth/token")
u.Path = path.Join(u.Path, "/oauth/token")
req, err := http.NewRequest(http.MethodPost, url.String(), strings.NewReader(params.Encode()))
req, err := http.NewRequest(http.MethodPost, u.String(), strings.NewReader(params.Encode()))
if err != nil {
return err
}