From c63f290928f223271283b92c6fc564f325e2313c Mon Sep 17 00:00:00 2001 From: 178inaba <178inaba@users.noreply.github.com> Date: Sat, 15 Apr 2017 04:36:27 +0900 Subject: [PATCH] Fix var name url to u --- apps.go | 6 +++--- mastodon.go | 12 ++++++------ streaming.go | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/apps.go b/apps.go index b5a66d2..4f2e4a4 100644 --- a/apps.go +++ b/apps.go @@ -45,13 +45,13 @@ func RegisterApp(appConfig *AppConfig) (*Application, error) { params.Set("scopes", appConfig.Scopes) params.Set("website", appConfig.Website) - url, err := url.Parse(appConfig.Server) + u, err := url.Parse(appConfig.Server) if err != nil { return nil, err } - url.Path = path.Join(url.Path, "/api/v1/apps") + u.Path = path.Join(u.Path, "/api/v1/apps") - 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 nil, err } diff --git a/mastodon.go b/mastodon.go index b49da71..2919e66 100644 --- a/mastodon.go +++ b/mastodon.go @@ -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 } diff --git a/streaming.go b/streaming.go index 6ccf82d..68a2c9e 100644 --- a/streaming.go +++ b/streaming.go @@ -69,11 +69,11 @@ func handleReader(ctx context.Context, q chan Event, r io.Reader) error { // StreamingPublic return channel to read events. func (c *Client) StreamingPublic(ctx context.Context) (chan Event, error) { - url, err := url.Parse(c.config.Server) + u, err := url.Parse(c.config.Server) if err != nil { return nil, err } - url.Path = path.Join(url.Path, "/api/v1/streaming/public") + u.Path = path.Join(u.Path, "/api/v1/streaming/public") var resp *http.Response @@ -82,7 +82,7 @@ func (c *Client) StreamingPublic(ctx context.Context) (chan Event, error) { defer ctx.Done() for { - req, err := http.NewRequest(http.MethodGet, url.String(), nil) + req, err := http.NewRequest(http.MethodGet, u.String(), nil) if err == nil { req.Header.Set("Authorization", "Bearer "+c.config.AccessToken) resp, err = c.Do(req)