Crow/include/http_request.h

39 lines
817 B
C
Raw Normal View History

2014-04-01 13:58:52 +00:00
#pragma once
2014-04-14 15:31:51 +00:00
#include "common.h"
#include "ci_map.h"
2014-04-14 15:31:51 +00:00
2014-04-26 17:19:59 +00:00
namespace crow
2014-04-01 13:58:52 +00:00
{
template <typename T>
inline const std::string& get_header_value(const T& headers, const std::string& key)
{
if (headers.count(key))
{
return headers.find(key)->second;
}
static std::string empty;
return empty;
}
2014-04-01 13:58:52 +00:00
struct request
{
HTTPMethod method;
2014-04-01 13:58:52 +00:00
std::string url;
ci_map headers;
2014-04-01 13:58:52 +00:00
std::string body;
void add_header(std::string key, std::string value)
{
headers.emplace(std::move(key), std::move(value));
}
const std::string& get_header_value(const std::string& key)
{
return crow::get_header_value(headers, key);
}
2014-09-06 19:30:53 +00:00
void* middleware_context{};
2014-04-01 13:58:52 +00:00
};
}