Commit 80007999 authored by Corentin Barreau's avatar Corentin Barreau
Browse files

Fix: endpoints URLs

parent 0e4fd1ab
......@@ -11,7 +11,7 @@ func (c *Client) Feed(size int) (feedResponse *FeedResponse, err error) {
feedResponse = new(FeedResponse)
// build request
req, err := http.NewRequest("GET", feedEndpoint.String(), nil)
req, err := http.NewRequest("GET", FeedEndpoint.String(), nil)
if err != nil {
return feedResponse, err
}
......
......@@ -23,7 +23,7 @@ func (c *Client) Finished(URLs []URL, URLType string) (finishedResponse *Finishe
}
// build request
req, err := http.NewRequest("POST", finishedEndpoint.String(), bytes.NewReader(jsonPayload))
req, err := http.NewRequest("POST", FinishedEndpoint.String(), bytes.NewReader(jsonPayload))
if err != nil {
return finishedResponse, err
}
......
......@@ -7,9 +7,9 @@ import (
)
var (
discoveredEndpoint *url.URL
finishedEndpoint *url.URL
feedEndpoint *url.URL
DiscoveredEndpoint *url.URL
FinishedEndpoint *url.URL
FeedEndpoint *url.URL
Version = "1.0.0"
)
......@@ -23,24 +23,24 @@ func Init(key, secret, project, HQAddress string) (c *Client, err error) {
c.HTTPClient = http.DefaultClient
c.HQAddress = HQAddress
discoveredEndpoint, err := url.Parse(c.HQAddress)
DiscoveredEndpoint, err = url.Parse(c.HQAddress)
if err != nil {
return c, err
}
finishedEndpoint, err := url.Parse(c.HQAddress)
FinishedEndpoint, err = url.Parse(c.HQAddress)
if err != nil {
return c, err
}
feedEndpoint, err := url.Parse(c.HQAddress)
FeedEndpoint, err = url.Parse(c.HQAddress)
if err != nil {
return c, err
}
discoveredEndpoint.Path = path.Join(discoveredEndpoint.Path, "discovered")
finishedEndpoint.Path = path.Join(finishedEndpoint.Path, "finished")
feedEndpoint.Path = path.Join(feedEndpoint.Path, "feed")
DiscoveredEndpoint.Path = path.Join(DiscoveredEndpoint.Path, "discovered")
FinishedEndpoint.Path = path.Join(FinishedEndpoint.Path, "finished")
FeedEndpoint.Path = path.Join(FeedEndpoint.Path, "feed")
return c, nil
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment