1#ifndef TENDUKE_HTTP_HTTPREQUEST_H
2#define TENDUKE_HTTP_HTTPREQUEST_H
4#include "./HTTPRequestAuthenticator.h"
10namespace tenduke {
namespace http {
37 const std::multimap<std::string, std::string> &headers = std::multimap<std::string, std::string>(),
38 std::shared_ptr<const tenduke::http::HTTPRequestAuthenticator> requestAuthenticator =
nullptr,
39 std::string messageBody =
"",
42 ) : method(std::move(method)), messageBody(std::move(messageBody)), url(std::move(url)), headers(headers),
43 requestAuthenticator(std::move(requestAuthenticator)), connectionTimeoutMs(connectionTimeoutMs), timeoutMs(timeoutMs)
56 const std::string &
getMethod()
const {
return method;}
62 const std::string &
getUrl()
const {
return url;}
68 const std::multimap<std::string, std::string> &
getHeaders()
const {
return headers;}
74 const std::shared_ptr<const tenduke::http::HTTPRequestAuthenticator> &
getRequestAuthenticator()
const {
return requestAuthenticator;}
92 bool hasBody()
const {
return !messageBody.empty();}
95 const std::string method;
96 const std::string messageBody;
97 const std::string url;
98 const std::multimap<std::string, std::string> headers;
99 const std::shared_ptr<const tenduke::http::HTTPRequestAuthenticator> requestAuthenticator;
100 const long connectionTimeoutMs;
101 const long timeoutMs;
HTTP-request, which contains all necessary details to construct the request.
Definition HTTPRequest.h:22
const std::string & getUrl() const
Returns the URL.
Definition HTTPRequest.h:62
long getTimeoutMs() const
Returns time out in ms.
Definition HTTPRequest.h:86
const std::shared_ptr< const tenduke::http::HTTPRequestAuthenticator > & getRequestAuthenticator() const
Returns HTTP request authenticator.
Definition HTTPRequest.h:74
HTTPRequest(std::string method, std::string url, const std::multimap< std::string, std::string > &headers=std::multimap< std::string, std::string >(), std::shared_ptr< const tenduke::http::HTTPRequestAuthenticator > requestAuthenticator=nullptr, std::string messageBody="", long connectionTimeoutMs=DEFAULT_CONNECTION_TIMEOUT_MS, long timeoutMs=DEFAULT_TIMEOUT_MS)
Constructs new instance.
Definition HTTPRequest.h:34
const std::string & getMethod() const
Returns the method.
Definition HTTPRequest.h:56
bool hasBody() const
Checks if request has body.
Definition HTTPRequest.h:92
const std::multimap< std::string, std::string > & getHeaders() const
Returns request headers.
Definition HTTPRequest.h:68
const std::string & getMessageBody() const
Returns the message body.
Definition HTTPRequest.h:50
long getConnectionTimeoutMs() const
Returns connection timeout in ms.
Definition HTTPRequest.h:80
const long DEFAULT_CONNECTION_TIMEOUT_MS
Default connection time out in milliseconds.
Definition HTTPRequest.h:13
const long DEFAULT_TIMEOUT_MS
Default total time out in milliseconds.
Definition HTTPRequest.h:16
Root for classes, functions and globals of 10Duke C++ Client.
Definition APIRequest.h:4