19 #include <hicn/transport/portability/win_portability.h>
22 #include <hicn/transport/utils/membuf.h>
28 #define HTTP_VERSION "1.1"
34 typedef enum { GET, POST, PUT, PATCH, DELETE } HTTPMethod;
36 static std::map<HTTPMethod, std::string> method_map = {
37 {GET,
"GET"}, {POST,
"POST"}, {PUT,
"PUT"},
38 {PATCH,
"PATCH"}, {DELETE,
"DELETE"},
41 typedef std::map<std::string, std::string> HTTPHeaders;
42 typedef std::unique_ptr<utils::MemBuf> HTTPPayload;
48 const HTTPHeaders getHeaders() {
return headers_; };
50 void coalescePayloadBuffer() {
51 auto it = headers_.find(
"Content-Length");
52 if (it != headers_.end()) {
53 auto content_length = std::stoul(it->second);
54 payload_->gather(content_length);
58 HTTPPayload &&getPayload() {
return std::move(payload_); }
60 std::string getHttpVersion()
const {
return http_version_; };
65 std::string http_version_;