16 PostHttpRequestJson::PostHttpRequestJson()
70 const std::map<std::string, ConstElementPtr>& map_value = body->mapValue();
71 auto map_element = map_value.find(element_name);
72 if (map_element != map_value.end()) {
73 return (map_element->second);
77 }
catch (
const std::exception& ex) {
79 << element_name <<
": " << ex.
what());
91 }
catch (
const std::exception& ex) {
93 " request: " << ex.
what());
data::ConstElementPtr getBodyAsJson() const
Retrieves JSON body.
bool finalized_
Flag indicating whether finalize was called.
virtual void finalize()
Complete parsing of the HTTP request.
HttpRequestContextPtr context_
Pointer to the HttpRequestContext holding parsed data.
Represents HTTP POST request.
data::ConstElementPtr getJsonElement(const std::string &element_name) const
Retrieves a single JSON element.
Exception thrown when body of the HTTP message is not JSON.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
bool created_
Flag indicating whether create was called.
virtual void reset()
Reset the state of the object.
PostHttpRequestJson()
Constructor for inbound HTTP request.
boost::shared_ptr< const Element > ConstElementPtr
int version()
returns Kea hooks version.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
Defines the logger used by the top-level component of kea-dhcp-ddns.
void checkFinalized() const
Checks if the finalize was called.
void setBodyAsJson(const data::ConstElementPtr &body)
Sets JSON body for an outbound message.
data::ConstElementPtr json_
Pointer to the parsed JSON body.
const HttpRequestContextPtr & context() const
Returns pointer to the HttpRequestContext.
virtual void create()
Commits information held in the context into the request.
boost::shared_ptr< BasicHttpAuth > BasicHttpAuthPtr
Type of pointers to basic HTTP authentication objects.
void parseBodyAsJson()
Interprets body as JSON, which can be later retrieved using data element objects. ...
void requireHeaderValue(const std::string &header_name, const std::string &header_value)
Specifies a required value of a header in the message.
virtual void reset()
Reset the state of the object.