class IDRAC::Client

def get(path:, headers: {})

def get(path:, headers: {})
  # For screenshot functionality, we need to use the WebUI cookies
  if @cookies.nil? && path.include?('screen/screen.jpg')
    webui_login unless @session_id
  end
  
  headers_to_use = {
    "User-Agent" => "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36",
    "Accept-Encoding" => "deflate, gzip"
  }
  
  if @cookies
    headers_to_use["Cookie"] = @cookies
  elsif @direct_mode
    # In direct mode, use Basic Auth
    headers_to_use["Authorization"] = "Basic #{Base64.strict_encode64("#{username}:#{password}")}"
  elsif @x_auth_token
    headers_to_use["X-Auth-Token"] = @x_auth_token
  end
  
  response = HTTParty.get(
    "#{base_url}/#{path}",
    headers: headers_to_use.merge(headers),
    verify: false
  )
end