-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHTTPRequest.cpp
63 lines (49 loc) · 1.39 KB
/
HTTPRequest.cpp
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
57
58
59
60
61
62
63
#include "HTTPRequest.h"
#include "HTTP.h"
HTTPRequest::HTTPRequest() {
method = HTTPRequest::HTTPMethod_GET;
use_cache = false;
force_max_age = 0;
}
HTTPRequest::~HTTPRequest() {
}
HTTPRequest::HTTPMethod HTTPRequest::GetMethod() {
return method;
}
void HTTPRequest::SetMethod(HTTPMethod _method) {
method = _method;
}
const std::string HTTPRequest::GetURL() {
return url;
}
void HTTPRequest::SetURL(const std::string _url) {
url = _url;
}
void HTTPRequest::SetUseCache(bool _use_cache) {
use_cache = _use_cache;
}
void HTTPRequest::SetForceMaxAge(int _force_max_age) {
force_max_age = _force_max_age;
};
bool HTTPRequest::GetUseCache() {
return use_cache;
}
void HTTPRequest::AppendHeader(const std::string _name,
const std::string _content) {
header_vector.push_back((HeaderField){_name, _content});
}
void HTTPRequest::ClearHeader() {
header_vector.clear();
}
void HTTPRequest::AppendBody(const std::string _name,
const std::string _content) {
body_vector.push_back((BodyField){_name, _content, std::string("")});
}
void HTTPRequest::AppendBodyWithFile(const std::string _name,
const std::string _file_path) {
HTTP_DEBUG((access(_file_path.c_str(), F_OK) != 0), "HTTPRequest로 보내실 파일이 존재하지 않습니다.");
body_vector.push_back((BodyField){_name, std::string(""), _file_path});
}
void HTTPRequest::ClearBody() {
body_vector.clear();
}