response.hpp
1 #ifndef XXHR_RESPONSE_H
2 #define XXHR_RESPONSE_H
3 
4 #include <cstdint>
5 #include <string>
6 
7 #include "cookies.hpp"
8 #include "xxhrtypes.hpp"
9 #include "defines.hpp"
10 #include "error.hpp"
11 
12 namespace xxhr {
13 
18 class Response {
19  public:
20  Response() = default;
21 
22  template <typename TextType, typename HeaderType, typename UrlType, typename CookiesType,
23  typename ErrorType>
24  Response(const std::int32_t& p_status_code, ErrorType&& p_error, TextType&& p_text, HeaderType&& p_header, UrlType&& p_url, CookiesType&& p_cookies = Cookies{})
25  : status_code{p_status_code},
26  error{XXHR_FWD(p_error)}, text{XXHR_FWD(p_text)}, header{XXHR_FWD(p_header)},
27  url{XXHR_FWD(p_url)}, cookies{XXHR_FWD(p_cookies)} {}
28 
30  std::int32_t status_code;
31 
34 
36  std::string text;
37 
40 
42  Url url;
43 
45  Cookies cookies;
46 
47 };
48 
49 } // namespace xxhr
50 
51 #endif
xxhr::Response::status_code
std::int32_t status_code
HTTP Status Code as Specified in HTTP RFC.
Definition: response.hpp:30
xxhr::Response::cookies
Cookies cookies
Cookies that the server would like you to keep reminding in future queries.
Definition: response.hpp:45
xxhr::Response::text
std::string text
Response body.
Definition: response.hpp:36
xxhr::Response::error
Error error
Error condition proper to a lower layer than HTTP.
Definition: response.hpp:33
xxhr::Response::header
Header header
Headers entries sent in the response.
Definition: response.hpp:39
xxhr::Error
Represents Errors happening at a lower layer than HTTP.
Definition: error.hpp:46
xxhr::Response
Passed to the unary callback xxhr::on_response. Provides access to request Content and Success,...
Definition: response.hpp:18
xxhr
main library namespace
Definition: api.hpp:20
xxhr::Response::url
Url url
Url that served this.
Definition: response.hpp:42
xxhr::Header
std::map< std::string, std::string, CaseInsensitiveCompare > Header
HTTP Headers to add to the request or received in xxhr::Response.
Definition: xxhrtypes.hpp:23