code: func (c *Client) newResponse(res *http.Response, maxBodySize int64) (*Response, error) {
  	r := &Response{
  		StatusCode: res.StatusCode,
  		Header:     res.Header,
  	}
  	if res.Body != nil {
  		body := io.Reader(res.Body)
  		if maxBodySize > 0 {
  			if res.ContentLength > maxBodySize {
  				return nil, ErrResponseSize
  			}
  			body = io.LimitReader(body, maxBodySize+1)
  		}
  		slurp, err := ioutil.ReadAll(body)
  		if err != nil {
  			return nil, err
  		}
  		if maxBodySize > 0 && int64(len(slurp)) > maxBodySize {
  			return nil, ErrResponseSize
  		}
  		// HEAD requests return a body but no content
  		if len(slurp) > 0 {
  			r.Body = json.RawMessage(slurp)
  		}
  	}
  	return r, nil
  }
docs: // newResponse creates a new response from the HTTP response.