resolve url reference in get
This commit is contained in:
parent
91397481f0
commit
88e58e0ed5
|
@ -73,16 +73,12 @@ func (c *Client) RequestSchedule(sportId, teamId string) ([]byte, error) {
|
||||||
query.Add("teamId", teamId)
|
query.Add("teamId", teamId)
|
||||||
endpoint.RawQuery = query.Encode()
|
endpoint.RawQuery = query.Encode()
|
||||||
|
|
||||||
url := c.baseURL.ResolveReference(&endpoint)
|
return c.get(&endpoint)
|
||||||
|
|
||||||
return c.get(url.String())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) RequestFeed(gamePk string) ([]byte, error) {
|
func (c *Client) RequestFeed(gamePk string) ([]byte, error) {
|
||||||
endpoint := url.URL{Path: "api/v1.1/game/" + gamePk + "/feed/live"}
|
endpoint := url.URL{Path: "api/v1.1/game/" + gamePk + "/feed/live"}
|
||||||
url := c.baseURL.ResolveReference(&endpoint)
|
return c.get(&endpoint)
|
||||||
|
|
||||||
return c.get(url.String())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) RequestDiffPatch(gamePk, startTimecode, pushUpdateId string) (DiffPatchResponse, error) {
|
func (c *Client) RequestDiffPatch(gamePk, startTimecode, pushUpdateId string) (DiffPatchResponse, error) {
|
||||||
|
@ -93,13 +89,13 @@ func (c *Client) RequestDiffPatch(gamePk, startTimecode, pushUpdateId string) (D
|
||||||
query.Add("pushUpdateId", pushUpdateId)
|
query.Add("pushUpdateId", pushUpdateId)
|
||||||
endpoint.RawQuery = query.Encode()
|
endpoint.RawQuery = query.Encode()
|
||||||
|
|
||||||
url := c.baseURL.ResolveReference(&endpoint)
|
return c.get(&endpoint)
|
||||||
|
|
||||||
return c.get(url.String())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Client) get(url string) ([]byte, error) {
|
func (c *Client) get(endpoint *url.URL) ([]byte, error) {
|
||||||
req, err := http.NewRequest("GET", url, nil)
|
url := c.baseURL.ResolveReference(endpoint)
|
||||||
|
|
||||||
|
req, err := http.NewRequest("GET", url.String(), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue