http_post.hpp
1 #ifndef NOOS_CLOUD_ASIO_HTTP_POST
2 #define NOOS_CLOUD_ASIO_HTTP_POST
3 /*
4  * LICENSE HERE
5  */
6 #include "includes.ihh"
7 #include <noos/objects/globals.hpp>
8 namespace noos {
10 namespace cloud {
18 class http_post
19 {
20 public:
26  http_post(std::string boundary);
27 
34  void add_content(
35  const std::string name,
36  const std::string content,
37  bool newline
38  );
39 
47  void add_content(
48  const std::string name,
49  const std::string filename,
50  const std::vector<noos::types::byte> bytes
51  );
52 
54  void end();
55 
57  std::string to_string() const;
58 
60  unsigned int size() const;
61 
62 private:
63  std::string data_;
64  std::string boundary_;
65  std::atomic<bool> open_ = {true};
66 };
67 }
68 }
69 #endif
std::string to_string() const
get the POST
use to store and pass POST data and realted info
Definition: http_post.hpp:18
unsigned int size() const
get POST data Content-Length
Definition: asio_handler.hpp:14
void add_content(const std::string name, const std::string content, bool newline)
add multipart/form-data content to the POST data
http_post(std::string boundary)
preferred constructor
void end()
call once, closes the POST boundary