code: func (c *Client) NewRequest(method, urlStr string, body interface{}) (*http.Request, error) {
  	rel, err := url.Parse(urlStr)
  	if err != nil {
  		return nil, err
  	}
  	// Relative URLs should be specified without a preceding slash since baseURL will have the trailing slash
  	rel.Path = strings.TrimLeft(rel.Path, "/")
  
  	u := c.baseURL.ResolveReference(rel)
  
  	var buf io.ReadWriter
  	if body != nil {
  		buf = new(bytes.Buffer)
  		err = json.NewEncoder(buf).Encode(body)
  		if err != nil {
  			return nil, err
  		}
  	}
  
  	req, err := http.NewRequest(method, u.String(), buf)
  	if err != nil {
  		return nil, err
  	}
  
  	req.Header.Set("Content-Type", "application/json")
  
  	// Set authentication information
  	if c.Authentication.authType == authTypeSession {
  		// Set session cookie if there is one
  		if c.session != nil {
  			for _, cookie := range c.session.Cookies {
  				req.AddCookie(cookie)
  			}
  		}
  	} else if c.Authentication.authType == authTypeBasic {
  		// Set basic auth information
  		if c.Authentication.username != "" {
  			req.SetBasicAuth(c.Authentication.username, c.Authentication.password)
  		}
  	}
  
  	return req, nil
  }
docs: // NewRequest creates an API request.
  // A relative URL can be provided in urlStr, in which case it is resolved relative to the baseURL of the Client.
  // If specified, the value pointed to by body is JSON encoded and included as the request body.