FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

GitHub Viewer

#include "expresscpp/request.hpp" #include #include #include #include #include "boost/uuid/uuid_generators.hpp" #include "boost/uuid/uuid_io.hpp" using namespace std::string_literals; namespace expresscpp { Request::Request(std::string_view path, HttpMethod method) : path_(path), method_(method) { Init(); } void Request::Init() { timestamp_ = std::chrono::system_clock::now(); uuid_ = boost::uuids::random_generator()(); originalUrl_ = path_; } std::string Request::getBody() const { return body_; } void Request::setBody(const std::string &body) { body_ = body; } HttpMethod Request::getMethod() const { return method_; } void Request::setMethod(const HttpMethod &method) { method_ = method; } std::shared_ptr Request::getRoute() const { return route_; } void Request::setRoute(const std::shared_ptr &route) { route_ = route; } void Request::setHeader(const std::string &key, const std::string &value) { headers_[key] = value; } std::string Request::getHeader(const std::string &key) const { const auto itr = headers_.find(key); if (itr != headers_.end()) { return itr->second; } return ""; } std::map Request::getHeaders() const { return headers_; } std::string_view Request::getPath() const { return path_; } void Request::setPath(const std::string_view &path) { path_ = path; } std::string Request::getTimeStamp() const { time_t now_time = std::chrono::system_clock::to_time_t(timestamp_); const auto gmt_time = gmtime(&now_time); std::stringstream ss; ss

Back | FazBrowse Home | New Git URL