diff --git a/includes/playdar/playdar_response.h b/includes/playdar/playdar_response.h index f137be1..66fbf00 100644 --- a/includes/playdar/playdar_response.h +++ b/includes/playdar/playdar_response.h @@ -39,7 +39,31 @@ class playdar_response { { init( s.c_str(), isBody ); } + + void add_header( const std::string& k, const std::string& v, bool replace = true ) + { + if( replace || m_headers.find(k) == m_headers.end() ) + m_headers[k] = v; + } + + void set_response_code( const int code ) + { + m_responseCode = code; + } + + operator const std::string &() const + { + return m_string; + } + + const std::string& str() const{ return m_string; } + + int response_code() const{ return m_responseCode; } + const std::map& headers() const{ return m_headers; } + + bool is_valid(){ return m_valid; } +private: void init( const char* s, bool isBody ) { add_header( "Content-Type", "text/html" ); @@ -76,30 +100,6 @@ class playdar_response { m_string = r.str(); } - void add_header( const std::string& k, const std::string& v, bool replace = true ) - { - if( replace || m_headers.find(k) == m_headers.end() ) - m_headers[k] = v; - } - - void set_response_code( const int code ) - { - m_responseCode = code; - } - - operator const std::string &() const - { - return m_string; - } - - const std::string& str() const{ return m_string; } - - int response_code() const{ return m_responseCode; } - const std::map& headers() const{ return m_headers; } - - bool is_valid(){ return m_valid; } - -private: std::string m_string; std::map m_headers; int m_responseCode;