ConstElementPtr
PostHttpRequestJson::getJsonElement(const std::string& element_name) {
- typedef std::map<std::string, ConstElementPtr> MapElementType;
try {
ConstElementPtr body = getBodyAsJson();
if (body) {
- const MapElementType& map_value = body->mapValue();
- MapElementType::const_iterator map_element =
- map_value.find(element_name);
+ const std::map<std::string, ConstElementPtr>& map_value = body->mapValue();
+ auto map_element = map_value.find(element_name);
if (map_element != map_value.end()) {
return (map_element->second);
}
void
HttpRequest::create() {
- typedef std::vector<HttpHeaderContext> HeadersVector;
- typedef std::map<std::string, std::string> HeadersMap;
try {
// The RequestParser doesn't validate the method name. Thus, this
// may throw an exception. But, we're fine with lower case names,
}
// Copy headers from the context.
- for (HeadersVector::iterator header = context_->headers_.begin();
+ for (auto header = context_->headers_.begin();
header != context_->headers_.end();
++header) {
headers_[header->name_] = header->value_;
// Iterate over required headers and check that they exist
// in the HTTP request.
- for (HeadersMap::iterator req_header = required_headers_.begin();
+ for (auto req_header = required_headers_.begin();
req_header != required_headers_.end();
++req_header) {
- HeadersMap::iterator header = headers_.find(req_header->first);
+ auto header = headers_.find(req_header->first);
if (header == headers_.end()) {
isc_throw(BadValue, "required header " << header->first
<< " not found in the HTTP request");
std::string
HttpRequest::getHeaderValue(const std::string& header) const {
- typedef std::map<std::string, std::string> HeadersMap;
checkCreated();
- HeadersMap::const_iterator header_it = headers_.find(header);
+ auto header_it = headers_.find(header);
if (header_it != headers_.end()) {
return (header_it->second);
}
// This test verifies that JSON body can be retrieved from the
// HTTP request.
TEST_F(PostHttpRequestJsonTest, getBodyAsJson) {
- typedef std::map<std::string, ConstElementPtr> MapElementType;
// Create HTTP POST request with JSON body.
setContextBasics("POST", "/isc/org", std::make_pair(1, 0));
addHeaderToContext("Content-Length", json_body_.length());
// Iterate over JSON values and store them in a simple map.
std::map<std::string, std::string> config_values;
- for (MapElementType::const_iterator config_element =
- json->mapValue().begin();
+ for (auto config_element = json->mapValue().begin();
config_element != json->mapValue().end();
++config_element) {
ASSERT_FALSE(config_element->first.empty());