-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHTTP.cpp
More file actions
57 lines (49 loc) · 1.48 KB
/
HTTP.cpp
File metadata and controls
57 lines (49 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include <cctype>
#include <string>
#include "HTTP.h"
namespace LibMatrix {
bool CaseInsensitiveCompare::operator()(const std::string& a, const std::string& b) const noexcept {
return std::lexicographical_compare(
a.begin(), a.end(), b.begin(), b.end(),
[](unsigned char ac, unsigned char bc) { return std::tolower(ac) < std::tolower(bc); });
}
HTTPRequestData::HTTPRequestData(HTTPMethod method, const std::string& subPath)
: method(method), subPath(subPath)
{}
void HTTPRequestData::setMethod(const HTTPMethod method) {
this->method = method;
}
void HTTPRequestData::setSubPath(const std::string& subPath) {
this->subPath = subPath;
}
void HTTPRequestData::setBody(const std::string& data) {
this->data = data;
}
void HTTPRequestData::setHeaders(std::shared_ptr<Headers> headers) {
this->headers = headers;
}
void HTTPRequestData::setResponseCallback(ResponseCallback callback) {
this->callback = callback;
}
void HTTPRequestData::setErrorCallback(ErrorCallback callback) {
this->errorCallback = callback;
}
HTTPMethod HTTPRequestData::getMethod() const {
return method;
}
const std::string& HTTPRequestData::getSubPath() const {
return subPath;
}
const std::string& HTTPRequestData::getBody() const {
return data;
}
std::shared_ptr<Headers> HTTPRequestData::getHeaders() const {
return headers;
}
ResponseCallback HTTPRequestData::getResponseCallback() const {
return callback;
}
ErrorCallback HTTPRequestData::getErrorCallback() const {
return errorCallback;
}
} // namespace LibMatrix