diff --git a/client.go b/client.go index f15b984..39d4c51 100644 --- a/client.go +++ b/client.go @@ -16,14 +16,14 @@ import ( // Client is containing the configured http.Client // and the host url type HttpBasicAuth struct { - User string - Pass string + User string + Pass string } type Client struct { - Url string + Url string HTTPClient *http.Client - Auth *HttpBasicAuth + Auth *HttpBasicAuth } type UpdateResp struct { @@ -44,9 +44,9 @@ func NewClient(host string, auth *HttpBasicAuth, tlsConfig *tls.Config) (*Client } return &Client{ - Url: h.String(), + Url: h.String(), HTTPClient: newHTTPClient(h, tlsConfig), - Auth: auth, + Auth: auth, }, nil } @@ -63,7 +63,7 @@ func (c *Client) do(method, path string, data interface{}) ([]byte, int, error) params = bytes.NewBuffer(buf) } - req, err := http.NewRequest(method, c.Url + path, params) + req, err := http.NewRequest(method, c.Url+path, params) if err != nil { return nil, -1, err } @@ -72,9 +72,9 @@ func (c *Client) do(method, path string, data interface{}) ([]byte, int, error) req.Header.Set("User-Agent", "gomarathon") req.Header.Set("Content-Type", "application/json") - if c.Auth != nil { - req.SetBasicAuth(c.Auth.User, c.Auth.Pass) - } + if c.Auth != nil { + req.SetBasicAuth(c.Auth.User, c.Auth.Pass) + } resp, err = c.HTTPClient.Do(req) if err != nil { @@ -113,11 +113,11 @@ func (c *Client) request(options *RequestOptions) (*Response, error) { v := url.Values{} if options.Params.Cmd != "" { - v.Set("cmd", url.QueryEscape(options.Params.Cmd)) + v.Set("cmd", options.Params.Cmd) } if options.Params.Host != "" { - v.Set("host", url.QueryEscape(options.Params.Host)) + v.Set("host", options.Params.Host) } if options.Params.Scale { @@ -125,7 +125,7 @@ func (c *Client) request(options *RequestOptions) (*Response, error) { } if options.Params.CallbackURL != "" { - v.Set("CallbackURL", url.QueryEscape(options.Params.CallbackURL)) + v.Set("CallbackURL", options.Params.CallbackURL) } path = fmt.Sprintf("%s?%s", path, v.Encode()) diff --git a/subscription.go b/subscription.go index d2bf424..f5b15fd 100644 --- a/subscription.go +++ b/subscription.go @@ -2,7 +2,6 @@ package gomarathon import ( "fmt" - "net/url" ) // RegisterCallbackURL register a new callback url @@ -11,7 +10,7 @@ func (c *Client) RegisterCallbackURL(uri string) (*Response, error) { Path: "eventSubscriptions", Method: "POST", Params: &Parameters{ - CallbackURL: url.QueryEscape(uri), + CallbackURL: uri, }, } r, err := c.request(options) @@ -44,7 +43,7 @@ func (c *Client) DeleteCallbackURL(uri string) (*Response, error) { Path: "eventSubscriptions", Method: "DELETE", Params: &Parameters{ - CallbackURL: url.QueryEscape(uri), + CallbackURL: uri, }, } r, err := c.request(options)