AWS IoT Device SDK C++ v2: Aws::Crt::Http::HttpMessage Class Reference

AWS IoT Device SDK C++ v2 1.14.0 AWS IoT Device SDK C++ v2

Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Aws::Crt::Http::HttpMessage Class Reference

`#include <HttpRequestResponse.h>`

Inheritance diagram for Aws::Crt::Http::HttpMessage:

## Public Member Functions
virtual | ~HttpMessage ()
| HttpMessage (const HttpMessage &)=delete
| HttpMessage (HttpMessage &&)=delete
HttpMessage & | operator= (const HttpMessage &)=delete
HttpMessage & | operator= (HttpMessage &&)=delete
std::shared_ptr< Aws::Crt::Io::InputStream > | GetBody () const noexcept
bool | SetBody (const std::shared_ptr< Aws::Crt::Io::IStream > &body) noexcept
bool | SetBody (const std::shared_ptr< Aws::Crt::Io::InputStream > &body) noexcept
size_t | GetHeaderCount () const noexcept
Optional< HttpHeader > | GetHeader (size_t index) const noexcept
bool | AddHeader (const HttpHeader &header) noexcept
bool | EraseHeader (size_t index) noexcept
| operator bool () const noexcept

## Protected Member Functions
| HttpMessage (Allocator *allocator, struct aws_http_message *message) noexcept

## Protected Attributes
Allocator * | m_allocator
struct aws_http_message * | m_message
std::shared_ptr< Aws::Crt::Io::InputStream > | m_bodyStream

## Detailed Description

Base class representing a mutable http request or response.

## Constructor & Destructor Documentation

## ◆ ~HttpMessage()

Aws::Crt::Http::HttpMessage::~HttpMessage | ( |  | ) |
| virtual

## ◆ HttpMessage() [1/3]

Aws::Crt::Http::HttpMessage::HttpMessage | ( | const HttpMessage & |  | ) |
| delete

## ◆ HttpMessage() [2/3]

Aws::Crt::Http::HttpMessage::HttpMessage | ( | HttpMessage && |  | ) |
| delete

## ◆ HttpMessage() [3/3]

Aws::Crt::Http::HttpMessage::HttpMessage | ( | Allocator * | allocator,
|  | struct aws_http_message * | message
| ) |  |
| protectednoexcept

## Member Function Documentation

## ◆ AddHeader()

bool Aws::Crt::Http::HttpMessage::AddHeader | ( | const HttpHeader & | header | ) |
| noexcept

Adds a header to the request

Parameters

  header | header to add

Returns
  success/failure

## ◆ EraseHeader()

bool Aws::Crt::Http::HttpMessage::EraseHeader | ( | size_t | index | ) |
| noexcept

Removes a header from the request

Parameters

  index | index of the header to remove

Returns
  success/failure

## ◆ GetBody()

std::shared_ptr< Aws::Crt::Io::InputStream > Aws::Crt::Http::HttpMessage::GetBody | ( |  | ) | const
| noexcept

Gets the input stream representing the message body

## ◆ GetHeader()

Optional< HttpHeader > Aws::Crt::Http::HttpMessage::GetHeader | ( | size_t | index | ) | const
| noexcept

Gets a particular header in the request

Parameters

  index | index of the header to fetch

Returns
  an option containing the requested header if the index is in bounds

## ◆ GetHeaderCount()

size_t Aws::Crt::Http::HttpMessage::GetHeaderCount | ( |  | ) | const
| noexcept

Gets the number of headers contained in this request

Returns
  the number of headers contained in this request

## ◆ operator bool()

Aws::Crt::Http::HttpMessage::operator bool | ( |  | ) | const
| inlinenoexcept

Returns
  true/false if the underlying object is valid

## ◆ operator=() [1/2]

HttpMessage & Aws::Crt::Http::HttpMessage::operator= | ( | const HttpMessage & |  | ) |
| delete

## ◆ operator=() [2/2]

HttpMessage & Aws::Crt::Http::HttpMessage::operator= | ( | HttpMessage && |  | ) |
| delete

## ◆ SetBody() [1/2]

bool Aws::Crt::Http::HttpMessage::SetBody | ( | const std::shared_ptr< Aws::Crt::Io::InputStream > & | body | ) |
| noexcept

Sets the input stream representing the message body

Parameters

  body | the input stream representing the message body

Returns
  success/failure

## ◆ SetBody() [2/2]

bool Aws::Crt::Http::HttpMessage::SetBody | ( | const std::shared_ptr< Aws::Crt::Io::IStream > & | body | ) |
| noexcept

Sets the input stream representing the message body

Parameters

  body | the input stream representing the message body

Returns
  success/failure

## Member Data Documentation

## ◆ m_allocator

Allocator* Aws::Crt::Http::HttpMessage::m_allocator
| protected

## ◆ m_bodyStream

std::shared_ptr<Aws::Crt::Io::InputStream> Aws::Crt::Http::HttpMessage::m_bodyStream
| protected

## ◆ m_message

struct aws_http_message* Aws::Crt::Http::HttpMessage::m_message
| protected

The documentation for this class was generated from the following files:

- crt/aws-crt-cpp/include/aws/crt/http/HttpRequestResponse.h
- crt/aws-crt-cpp/source/http/HttpRequestResponse.cpp