in binding-cpp/gym_binding.cpp [149:168]
Json::Value POST(const std::string& route, const std::string& post_data)
{
std::string url = "http://" + addr + route;
if (verbose) printf("POST %s\n%s\n", url.c_str(), post_data.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, 1);
curl_easy_setopt(h.get(), CURLOPT_POSTFIELDS, post_data.c_str());
curl_easy_setopt(h.get(), CURLOPT_POSTFIELDSIZE_LARGE, (curl_off_t)post_data.size());
curl_easy_setopt(h.get(), CURLOPT_HTTPHEADER, headers.get());
CURLcode 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;
}