body.hpp
1 #ifndef XXHR_BODY_H
2 #define XXHR_BODY_H
3 
4 #include <cstring>
5 
6 #include <initializer_list>
7 #include <string>
8 
9 #include "defines.hpp"
10 
11 #include <xxhr/parameters.hpp>
12 
13 namespace xxhr {
14 
24 struct Body {
25  Body() = default;
26  Body(const Body& rhs) = default;
27  Body(Body&& rhs) = default;
28  Body& operator=(const Body& rhs) = default;
29  Body& operator=(Body&& rhs) = default;
30 
32  Body(const std::string& std_string) : content(std_string), is_form_encoded(false) {}
33 
35  Body(const Parameters& params) : content(params.content), is_form_encoded(true) {}
36 
37  std::string content;
38  bool is_form_encoded;
39 };
40 
41 } // namespace xxhr
42 
43 #endif
xxhr::Body::Body
Body(const Parameters &params)
Construct an application/x-www-form-urlencoded Body from an xxhr::Parameter list.
Definition: body.hpp:35
xxhr::Body
The body sent with the request. Typically useful in xxhr::POST context but can be used in any request...
Definition: body.hpp:24
xxhr::Body::Body
Body(const std::string &std_string)
Construct a raw body from a string.
Definition: body.hpp:32
xxhr::Parameters
Allows passing an initializer list of named HTTP Parameters that will be URL Encoded within the reque...
Definition: parameters.hpp:29
xxhr
main library namespace
Definition: api.hpp:20