Function post

Synopsis

#include <include/restclient-cpp/restclient.h>

Response post(const std::string &url, const std::string &content_type, const std::string &data)

Description

HTTP POST method.

Parameters

url - to query

ctype - content type as string

data - HTTP POST body

Returns
response struct

Mentioned in

Source

Lines 73-88 in source/restclient.cc. Line 53 in include/restclient-cpp/restclient.h.

RestClient::Response RestClient::post(const std::string& url,
                                      const std::string& ctype,
                                      const std::string& data) {
#if __cplusplus >= 201402L
  auto conn = std::make_unique<RestClient::Connection>("");
  conn->AppendHeader("Content-Type", ctype);
  return conn->post(url, data);
#else
  RestClient::Response ret;
  RestClient::Connection *conn = new RestClient::Connection("");
  conn->AppendHeader("Content-Type", ctype);
  ret = conn->post(url, data);
  delete conn;
  return ret;
#endif
}





Add Discussion as Guest

Log in