Botan  2.6.0
Crypto and TLS for C++11
Public Member Functions | List of all members
Botan::HTTP::Response Class Referencefinal

#include <http_util.h>

Public Member Functions

const std::vector< uint8_t > & body () const
 
const std::map< std::string, std::string > & headers () const
 
 Response ()
 
 Response (unsigned int status_code, const std::string &status_message, const std::vector< uint8_t > &body, const std::map< std::string, std::string > &headers)
 
unsigned int status_code () const
 
std::string status_message () const
 
void throw_unless_ok ()
 

Detailed Description

Definition at line 23 of file http_util.h.

Constructor & Destructor Documentation

◆ Response() [1/2]

Botan::HTTP::Response::Response ( )
inline

Definition at line 26 of file http_util.h.

26 : m_status_code(0), m_status_message("Uninitialized") {}

◆ Response() [2/2]

Botan::HTTP::Response::Response ( unsigned int  status_code,
const std::string &  status_message,
const std::vector< uint8_t > &  body,
const std::map< std::string, std::string > &  headers 
)
inline

Definition at line 28 of file http_util.h.

30  :
31  m_status_code(status_code),
32  m_status_message(status_message),
33  m_body(body),
34  m_headers(headers) {}
unsigned int status_code() const
Definition: http_util.h:36
const std::map< std::string, std::string > & headers() const
Definition: http_util.h:40
const std::vector< uint8_t > & body() const
Definition: http_util.h:38
std::string status_message() const
Definition: http_util.h:42

Member Function Documentation

◆ body()

const std::vector<uint8_t>& Botan::HTTP::Response::body ( ) const
inline

Definition at line 38 of file http_util.h.

Referenced by Botan::HTTP::operator<<().

38 { return m_body; }

◆ headers()

const std::map<std::string, std::string>& Botan::HTTP::Response::headers ( ) const
inline

Definition at line 40 of file http_util.h.

Referenced by Botan::HTTP::operator<<().

40 { return m_headers; }

◆ status_code()

unsigned int Botan::HTTP::Response::status_code ( ) const
inline

Definition at line 36 of file http_util.h.

Referenced by Botan::HTTP::operator<<(), and throw_unless_ok().

36 { return m_status_code; }

◆ status_message()

std::string Botan::HTTP::Response::status_message ( ) const
inline

Definition at line 42 of file http_util.h.

Referenced by Botan::HTTP::operator<<(), and throw_unless_ok().

42 { return m_status_message; }

◆ throw_unless_ok()

void Botan::HTTP::Response::throw_unless_ok ( )
inline

Definition at line 44 of file http_util.h.

References status_code(), and status_message().

45  {
46  if(status_code() != 200)
47  throw Exception("HTTP error: " + status_message());
48  }
unsigned int status_code() const
Definition: http_util.h:36
std::string status_message() const
Definition: http_util.h:42

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