equal
deleted
inserted
replaced
15 ) |
15 ) |
16 |
16 |
17 // prepareRequest insert all pre-defined stuff |
17 // prepareRequest insert all pre-defined stuff |
18 func (g *Gondole) prepareRequest(what string) (req rest.Request) { |
18 func (g *Gondole) prepareRequest(what string) (req rest.Request) { |
19 endPoint := APIEndpoint + fmt.Sprintf("/%s/", what) |
19 endPoint := APIEndpoint + fmt.Sprintf("/%s/", what) |
20 key, ok := HasAPIKey() |
|
21 |
20 |
22 // Add at least one option, the APIkey if present |
21 // Add at least one option, the APIkey if present |
23 hdrs := make(map[string]string) |
22 hdrs := make(map[string]string) |
24 opts := make(map[string]string) |
23 opts := make(map[string]string) |
25 |
24 |
26 // Insert our sig |
25 // Insert our sig |
27 hdrs["User-Agent"] = fmt.Sprintf("Gondole/%s", APIVersion) |
26 hdrs["User-Agent"] = fmt.Sprintf("Gondole/%s", APIVersion) |
28 |
27 |
29 // Insert key |
|
30 if ok { |
|
31 opts["key"] = key |
|
32 } |
|
33 |
|
34 req = rest.Request{ |
28 req = rest.Request{ |
35 BaseURL: endPoint, |
29 BaseURL: endPoint, |
36 Headers: hdrs, |
30 Headers: hdrs, |
37 QueryParams: opts, |
31 QueryParams: opts, |
38 } |
32 } |