Malloy
Loading...
Searching...
No Matches
multipart_parser.hpp
1#pragma once
2
3#include "../http/request.hpp"
4
5#include <optional>
6#include <string>
7#include <vector>
8
9namespace malloy::html
10{
11
18 {
19 public:
23 struct part
24 {
25 std::string_view disposition;
26 std::string_view type;
27 std::string_view content;
28
29 part() = default;
30 part(const part&) = default;
31 part(part&&) noexcept = default;
32 virtual ~part() = default;
33
34 part& operator=(const part&) = default;
35 part& operator=(part&&) noexcept = default;
36 };
37
44 [[nodiscard]]
45 static
46 std::vector<part>
48
56 [[nodiscard]]
57 static
58 std::vector<part>
59 parse(std::string_view body, const std::string& boundary);
60
61 private:
62 constexpr static std::string_view str_disposition = { "Content-Disposition: " };
63 constexpr static std::string_view str_type = { "Content-Type: " };
64
65 [[nodiscard]]
66 static
67 std::optional<part>
68 parse_part(std::string_view part_raw);
69 };
70
71}
Definition: multipart_parser.hpp:18
static std::vector< part > parse(const malloy::http::request<> &req)
Definition: multipart_parser.cpp:9
Definition: request.hpp:19
Definition: form.hpp:12
Definition: multipart_parser.hpp:24