Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions include/crow/http_request.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,16 @@ namespace crow // NOTE: Already documented in "crow/app.h"
#endif

/// Find and return the value associated with the key. (returns an empty string if nothing is found)
template<typename T>
inline const std::string& get_header_value(const T& headers, const std::string& key)
inline const std::string& get_header_value(const ci_map& headers, const std::string& key)
{
if (headers.count(key))
{
return headers.find(key)->second;
static const std::string EMPTY;
const auto it = headers.find(key);
if (it != headers.end()) {
return it->second;
}
else {
return EMPTY;
}
static std::string empty;
return empty;
}

/// An HTTP request.
Expand Down
Loading