# Request.hpp

This File On Github
Ask A Question

API: latest
module: oatpp
#include "oatpp/web/protocol/http/outgoing/Request.hpp"

# Request

Class http::outgoing::Request AKA OutgoingRequest represents client's outgoing request to server.

namespace oatpp { namespace web { namespace protocol { namespace http { namespace outgoing { 
  class Request : public oatpp::base::Countable {}
}}}}}

# Typedefs

Type Name Summary
protocol::http::Headers Headers Convenience typedef for oatpp::web::protocol::http::Headers.

# Methods

Return Type Name Summary
[none] Request Constructor.
std::shared_ptr<Request> createShared Create shared Request.
const oatpp::data::share::StringKeyLabel& getMethod Get http method.
const oatpp::data::share::StringKeyLabel& getPath Get path to resource.
Headers& getHeaders Get headers map.
void putHeader Add http header.
bool putHeaderIfNotExists Add http header if not already exists.
bool putOrReplaceHeader Replaces or adds header.
bool putOrReplaceHeader_Unsafe Replaces or adds header.
void putHeader_Unsafe Add http header.
bool putHeaderIfNotExists_Unsafe Add http header if not already exists.
oatpp::String getHeader Get header value
void putBundleData Put data to bundle.
WrapperType getBundleData Get data from bundle by key.
const data::Bundle& getBundle Get bundle object.
std::shared_ptr<Body> getBody Get http body.
void send Write request to stream.
oatpp::async::CoroutineStarter sendAsync Write request to stream in asynchronous manner.

# Request::Headers

Convenience typedef for oatpp::web::protocol::http::Headers.

typedef protocol::http::Headers Headers

# Request::Request

Constructor.

Request(const oatpp::data::share::StringKeyLabel& method,
        const oatpp::data::share::StringKeyLabel& path,
        const Headers& headers,
        const std::shared_ptr<Body>& body)

# Request::createShared

Create shared Request.

static std::shared_ptr<Request> createShared(const oatpp::data::share::StringKeyLabel& method,
                                             const oatpp::data::share::StringKeyLabel& path,
                                             const Headers& headers,
                                             const std::shared_ptr<Body>& body)

# Request::getMethod

Get http method.

const oatpp::data::share::StringKeyLabel& getMethod() const

# Request::getPath

Get path to resource.

const oatpp::data::share::StringKeyLabel& getPath() const

# Request::getHeaders

Get headers map.

Headers& getHeaders()

# Request::putHeader

Add http header.

void putHeader(const oatpp::String& key, const oatpp::String& value)

# Request::putHeaderIfNotExists

Add http header if not already exists.

bool putHeaderIfNotExists(const oatpp::String& key, const oatpp::String& value)

# Request::putOrReplaceHeader

Replaces or adds header.

bool putOrReplaceHeader(const oatpp::String& key, const oatpp::String& value)

# Request::putOrReplaceHeader_Unsafe

Replaces or adds header.

bool putOrReplaceHeader_Unsafe(const oatpp::data::share::StringKeyLabelCI& key, const oatpp::data::share::StringKeyLabel& value)

# Request::putHeader_Unsafe

Add http header.

void putHeader_Unsafe(const oatpp::data::share::StringKeyLabelCI& key, const oatpp::data::share::StringKeyLabel& value)

# Request::putHeaderIfNotExists_Unsafe

Add http header if not already exists.

bool putHeaderIfNotExists_Unsafe(const oatpp::data::share::StringKeyLabelCI& key, const oatpp::data::share::StringKeyLabel& value)

# Request::getHeader

Get header value

oatpp::String getHeader(const oatpp::data::share::StringKeyLabelCI& headerName) const

# Request::putBundleData

Put data to bundle.

  • @param key
  • @param polymorph

void putBundleData(const oatpp::String& key, const oatpp::Void& polymorph)

# Request::getBundleData

Get data from bundle by key.

  • @tparam WrapperType
  • @param key
  • @return

template<typename WrapperType>
WrapperType getBundleData(const oatpp::String& key) const

# Request::getBundle

Get bundle object.

  • @return

const data::Bundle& getBundle() const

# Request::getBody

Get http body.

std::shared_ptr<Body> getBody()

# Request::send

Write request to stream.

void send(data::stream::OutputStream* stream)

# Request::sendAsync

Write request to stream in asynchronous manner.

static oatpp::async::CoroutineStarter sendAsync(std::shared_ptr<Request> _this,
                                                const std::shared_ptr<data::stream::OutputStream>& stream)