TODO(bradfitz): delete most of this. use new perkeep.org/pkg/blobserver/protocol types instead of a map[string]interface{}.
(requestName string, resp *http.Response)
| 137 | // TODO(bradfitz): delete most of this. use new perkeep.org/pkg/blobserver/protocol types instead |
| 138 | // of a map[string]interface{}. |
| 139 | func (c *Client) responseJSONMap(requestName string, resp *http.Response) (map[string]interface{}, error) { |
| 140 | if resp.StatusCode != 200 { |
| 141 | c.printf("After %s request, failed to JSON from response; status code is %d", requestName, resp.StatusCode) |
| 142 | io.Copy(os.Stderr, resp.Body) |
| 143 | return nil, fmt.Errorf("after %s request, HTTP response code is %d; no JSON to parse", requestName, resp.StatusCode) |
| 144 | } |
| 145 | jmap := make(map[string]interface{}) |
| 146 | if err := httputil.DecodeJSON(resp, &jmap); err != nil { |
| 147 | return nil, err |
| 148 | } |
| 149 | return jmap, nil |
| 150 | } |
| 151 | |
| 152 | func (c *Client) StatBlobs(ctx context.Context, blobs []blob.Ref, fn func(blob.SizedRef) error) error { |
| 153 | if c.sto != nil { |
no test coverage detected