MCPcopy
hub / github.com/perkeep/perkeep / responseJSONMap

Method responseJSONMap

pkg/client/upload.go:139–150  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

137// TODO(bradfitz): delete most of this. use new perkeep.org/pkg/blobserver/protocol types instead
138// of a map[string]interface{}.
139func (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
152func (c *Client) StatBlobs(ctx context.Context, blobs []blob.Ref, fn func(blob.SizedRef) error) error {
153 if c.sto != nil {

Callers 1

EnumerateBlobsOptsMethod · 0.95

Calls 2

printfMethod · 0.95
DecodeJSONFunction · 0.92

Tested by

no test coverage detected