Json::Value GET()

in binding-cpp/gym_binding.cpp [129:147]


	Json::Value GET(const std::string& route)
	{
		std::string url = "http://" + addr + route;
		if (verbose) printf("GET %s\n", url.c_str());
		curl_easy_setopt(h.get(), CURLOPT_URL, url.c_str());
		curl_easy_setopt(h.get(), CURLOPT_PORT, port);
		std::string answer;
		curl_easy_setopt(h.get(), CURLOPT_WRITEDATA, &answer);
		curl_easy_setopt(h.get(), CURLOPT_POST, 0);
		curl_easy_setopt(h.get(), CURLOPT_HTTPHEADER, 0);

		CURLcode r;
		r = curl_easy_perform(h.get());
		if (r) throw std::runtime_error(curl_error_buf.data());

		Json::Value j;
		throw_server_error_or_response_code(answer, j);
		return j;
	}