RequestExecutor.hpp

This File On Github
Ask A Question

API: latest
module: oatpp-curl
#include "oatpp-curl/RequestExecutor.hpp"

RequestExecutor

Curl request executor. Uses Curl to perform client to server requests.
Extends oatpp::web::client::RequestExecutor.

namespace oatpp { namespace curl { 
  class RequestExecutor : public oatpp::web::client::RequestExecutor {}
}}

Methods

Return Type Name Summary
[none] RequestExecutor Constructor.
std::shared_ptr<RequestExecutor> createShared Create shared RequestExecutor.
std::shared_ptr<ConnectionHandle> getConnection Connection reuse mechanism for curl RequestExecutor is NOT IMPLEMENTED yet.
oatpp::async::CoroutineStarterForResult<const std::shared_ptr<ConnectionHandle>&> getConnectionAsync Connection reuse mechanism for curl RequestExecutor is NOT IMPLEMENTED yet.
std::shared_ptr<Response> execute Execute http request. Implementation of oatpp::curl::RequestExecutor::execute() method.
oatpp::async::CoroutineStarterForResult<const std::shared_ptr<Response>&> executeAsync Same as RequestExecutor::execute() but Async.

RequestExecutor::RequestExecutor

Constructor.

  • @param baseUrl - base url for requests. Ex.: "https://oatpp.io/"
  • @param verbose - true to print curl logs to std::cout.

RequestExecutor(const oatpp::String& baseUrl, bool verbose = false)

RequestExecutor::createShared

Create shared RequestExecutor.

  • @param baseUrl - base url for requests. Ex.: "https://oatpp.io/"
  • @param verbose - true to print curl logs to std::cout.
  • @return - std::shared_ptr to RequestExecutor.

static std::shared_ptr<RequestExecutor> createShared(const oatpp::String& baseUrl, bool verbose = false)

RequestExecutor::getConnection

Connection reuse mechanism for curl RequestExecutor is NOT IMPLEMENTED yet.
Will throw std::runtime_error("[oatpp::curl::RequestExecutor::getConnection()]: Error. This call is not implemented yet");

std::shared_ptr<ConnectionHandle> getConnection() override

RequestExecutor::getConnectionAsync

Connection reuse mechanism for curl RequestExecutor is NOT IMPLEMENTED yet.
Will throw std::runtime_error("[oatpp::curl::RequestExecutor::getConnectionAsync(...)]: Error. This call is not implemented yet");

  • @return - oatpp::async::CoroutineStarterForResult.

oatpp::async::CoroutineStarterForResult<const std::shared_ptr<ConnectionHandle>&> getConnectionAsync() override

RequestExecutor::execute

Execute http request. Implementation of oatpp::curl::RequestExecutor::execute() method.

std::shared_ptr<Response> execute(const String& method,
                                  const String& path,
                                  const Headers& userDefinedHeaders,
                                  const std::shared_ptr<Body>& body,
                                  const std::shared_ptr<ConnectionHandle>& connectionHandle = nullptr) override

RequestExecutor::executeAsync

Same as RequestExecutor::execute() but Async.

virtual oatpp::async::CoroutineStarterForResult<const std::shared_ptr<Response>&>
executeAsync(const String& method,
             const String& path,
             const Headers& headers,
             const std::shared_ptr<Body>& body,
             const std::shared_ptr<ConnectionHandle>& connectionHandle = nullptr) override