request body support
This commit is contained in:
1 parent
e17fea3f61
commit
e1423e9fa8
8 files changed
+60
-11
No files matched your search
+17
-1
@@ -19,10 +19,26 @@ Headers::~Headers() {
|
||||
// TODO Auto-generated destructor stub
|
||||
}
|
||||
|
||||
void Headers::SetHeader(const std::string& key, const std::string& value) {
|
||||
void Headers::SetHeader(std::string& key, const std::string& value) {
|
||||
transform(key.begin(), key.end(), key.begin(), ::tolower);
|
||||
content[key] = value;
|
||||
}
|
||||
|
||||
int Headers::ContentLength() const
|
||||
{
|
||||
string len = GetValue("Content-Length");
|
||||
if (len.empty())return 0;
|
||||
return stoi(len);
|
||||
}
|
||||
|
||||
inline std::string Headers::GetValue(std::string key) const
|
||||
{
|
||||
transform(key.begin(), key.end(), key.begin(), ::tolower);
|
||||
if (content.count(key) == 0)
|
||||
return std::string();
|
||||
return content.at(key);
|
||||
}
|
||||
|
||||
ostream& operator<<(ostream& out, const chttp::Headers &h) {
|
||||
for (auto &p : h.content) {
|
||||
out << p.first;
|
||||
|
||||
Reference in new issue
Block a user