GetJSON sends a GET request to url, and unmarshals the returned JSON response into data. The URL's host must match the client's configured server.
(ctx context.Context, url string, data interface{})
| 1139 | // JSON response into data. The URL's host must match the client's |
| 1140 | // configured server. |
| 1141 | func (c *Client) GetJSON(ctx context.Context, url string, data interface{}) error { |
| 1142 | if !strings.HasPrefix(url, c.discoRoot()) { |
| 1143 | return fmt.Errorf("wrong URL (%q) for this server", url) |
| 1144 | } |
| 1145 | hreq := c.newRequest(ctx, "GET", url) |
| 1146 | resp, err := c.expect2XX(hreq) |
| 1147 | if err != nil { |
| 1148 | return err |
| 1149 | } |
| 1150 | return httputil.DecodeJSON(resp, data) |
| 1151 | } |
| 1152 | |
| 1153 | // Post is like http://golang.org/pkg/net/http/#Client.Post |
| 1154 | // but with implementation details like gated requests. The |
nothing calls this directly
no test coverage detected