10#include <unordered_map>
12#include <userver/http/predefined_header.hpp>
13#include <userver/utils/str_icase.hpp>
15USERVER_NAMESPACE_BEGIN
17namespace server::http {
25 std::unordered_map<std::string, Cookie, utils::StrCaseHash>;
27 static std::optional<Cookie> FromString(std::string_view cookie_str);
29 Cookie(std::string name, std::string value);
30 Cookie(Cookie&& cookie)
noexcept;
31 Cookie(
const Cookie& cookie);
34 Cookie& operator=(Cookie&&)
noexcept;
35 Cookie& operator=(
const Cookie& cookie);
37 const std::string& Name()
const;
38 const std::string& Value()
const;
40 bool IsSecure()
const;
43 std::chrono::system_clock::time_point Expires()
const;
44 Cookie& SetExpires(std::chrono::system_clock::time_point value);
46 bool IsPermanent()
const;
47 Cookie& SetPermanent();
49 bool IsHttpOnly()
const;
50 Cookie& SetHttpOnly();
52 const std::string& Path()
const;
53 Cookie& SetPath(std::string value);
55 const std::string& Domain()
const;
56 Cookie& SetDomain(std::string value);
58 std::chrono::seconds MaxAge()
const;
59 Cookie& SetMaxAge(std::chrono::seconds value);
61 std::string SameSite()
const;
62 Cookie& SetSameSite(std::string value);
64 std::string ToString()
const;
67 USERVER_NAMESPACE::http::
headers::HeadersString& os)
const;
71 std::unique_ptr<CookieData> data_;