code: func (r *Session) GetRemoteImageJSON(imgID, registry string) ([]byte, int64, error) {
  	res, err := r.client.Get(registry + "images/" + imgID + "/json")
  	if err != nil {
  		return nil, -1, fmt.Errorf("Failed to download json: %s", err)
  	}
  	defer res.Body.Close()
  	if res.StatusCode != 200 {
  		return nil, -1, newJSONError(fmt.Sprintf("HTTP code %d", res.StatusCode), res)
  	}
  	// if the size header is not present, then set it to '-1'
  	imageSize := int64(-1)
  	if hdr := res.Header.Get("X-Docker-Size"); hdr != "" {
  		imageSize, err = strconv.ParseInt(hdr, 10, 64)
  		if err != nil {
  			return nil, -1, err
  		}
  	}
  
  	jsonString, err := ioutil.ReadAll(res.Body)
  	if err != nil {
  		return nil, -1, fmt.Errorf("Failed to parse downloaded json: %v (%s)", err, jsonString)
  	}
  	return jsonString, imageSize, nil
  }
docs: // GetRemoteImageJSON retrieves an image's JSON metadata from the registry.