Represents a response to the client from the server. More...
#include <WebServerControl.h>
Public Member Functions | |
| Response ()=default | |
| Response (const unsigned int status_code) | |
| Construct a response given a status code.  More... | |
| Response (const unsigned int status_code, const nlohmann::json &json) | |
| Construct a response given a status code and JSON data.  More... | |
| unsigned int | getStatusCode () const | 
| bool | hasJSON () const | 
| const nlohmann::json & | getJSON () const | 
| bool | hasError () const | 
| const std::string & | getError () const | 
Protected Member Functions | |
| void | setError (const std::string &error) | 
| Set the error message.  More... | |
Private Attributes | |
| unsigned int | _status_code = 0 | 
| The status code.  More... | |
| std::optional< nlohmann::json > | _json | 
| The JSON data, if any.  More... | |
| std::optional< std::string > | _error | 
| The error message, if any.  More... | |
Represents a response to the client from the server.
Definition at line 126 of file WebServerControl.h.
      
  | 
  default | 
| WebServerControl::Response::Response | ( | const unsigned int | status_code | ) | 
Construct a response given a status code.
Definition at line 827 of file WebServerControl.C.
| WebServerControl::Response::Response | ( | const unsigned int | status_code, | 
| const nlohmann::json & | json | ||
| ) | 
Construct a response given a status code and JSON data.
Definition at line 829 of file WebServerControl.C.
| const std::string & WebServerControl::Response::getError | ( | ) | const | 
Definition at line 843 of file WebServerControl.C.
Referenced by WebServerControl::addServerAction().
| const nlohmann::json & WebServerControl::Response::getJSON | ( | ) | const | 
Definition at line 835 of file WebServerControl.C.
Referenced by WebServerControl::addServerAction().
      
  | 
  inline | 
Definition at line 142 of file WebServerControl.h.
Referenced by WebServerControl::addServerAction().
      
  | 
  inline | 
Definition at line 156 of file WebServerControl.h.
Referenced by WebServerControl::addServerAction().
      
  | 
  inline | 
Definition at line 147 of file WebServerControl.h.
Referenced by WebServerControl::addServerAction().
      
  | 
  inlineprotected | 
Set the error message.
Definition at line 166 of file WebServerControl.h.
Referenced by WebServerControl::ErrorResponse::ErrorResponse().
      
  | 
  private | 
The error message, if any.
Definition at line 174 of file WebServerControl.h.
Referenced by hasError(), and setError().
      
  | 
  private | 
      
  | 
  private | 
 1.8.14