summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJellyBrick <shlee1503@naver.com>2018-06-08 16:41:28 +0900
committerJellyBrick <shlee1503@naver.com>2018-06-08 16:41:28 +0900
commit093833a785cb25faf4afe3b5652c7598d778866f (patch)
treee91e25520fbefd6124b8950d7d1c2617fa20b6a1
parent1aee6428aef1fe5179e149477bf48f73f32d3ada (diff)
Resolve Travis-CI test
-rw-r--r--include/tgbot/net/HttpServer.h4
-rw-r--r--include/tgbot/net/TgWebhookServer.h2
-rw-r--r--test/tgbot/net/HttpParser.cpp8
3 files changed, 7 insertions, 7 deletions
diff --git a/include/tgbot/net/HttpServer.h b/include/tgbot/net/HttpServer.h
index e760e29..34cd9c7 100644
--- a/include/tgbot/net/HttpServer.h
+++ b/include/tgbot/net/HttpServer.h
@@ -43,7 +43,7 @@ protected:
class Connection;
public:
- typedef std::function<std::string (const std::string&, const std::map<std::string, std::string>)> ServerHandler;
+ typedef std::function<std::string (const std::string&, const std::unordered_map<std::string, std::string>)> ServerHandler;
HttpServer(std::shared_ptr<boost::asio::basic_socket_acceptor<Protocol>> acceptor, const ServerHandler& handler) : _acceptor(acceptor), _handler(handler) {
}
@@ -80,7 +80,7 @@ protected:
void start() {
data.reserve(10240);
socket->async_receive(data, [this]() {
- std::map<std::string, std::string> headers;
+ std::unordered_map<std::string, std::string> headers;
std::string body = HttpParser::getInstance().parseResponse(data, headers);
socket->async_send(_handler(body, headers));
});
diff --git a/include/tgbot/net/TgWebhookServer.h b/include/tgbot/net/TgWebhookServer.h
index 9352e82..696d126 100644
--- a/include/tgbot/net/TgWebhookServer.h
+++ b/include/tgbot/net/TgWebhookServer.h
@@ -37,7 +37,7 @@ public:
TgWebhookServer(std::shared_ptr<boost::asio::basic_socket_acceptor<Protocol>> acceptor, const typename HttpServer<Protocol>::ServerHandler& handler) = delete;
TgWebhookServer(std::shared_ptr<boost::asio::basic_socket_acceptor<Protocol>> acceptor, const std::string& path, const EventHandler* eventHandler) :
- HttpServer<Protocol>(acceptor, [eventHandler, &path](const std::string& data, const std::map<std::string, std::string>& headers) -> std::string {
+ HttpServer<Protocol>(acceptor, [eventHandler, &path](const std::string& data, const std::unordered_map<std::string, std::string>& headers) -> std::string {
if (headers.at("method") == "POST" && headers.at("path") == path) {
eventHandler->handleUpdate(TgTypeParser::getInstance().parseJsonAndGetUpdate(TgTypeParser::getInstance().parseJson(data)));
}
diff --git a/test/tgbot/net/HttpParser.cpp b/test/tgbot/net/HttpParser.cpp
index 9272736..d0a3703 100644
--- a/test/tgbot/net/HttpParser.cpp
+++ b/test/tgbot/net/HttpParser.cpp
@@ -91,10 +91,10 @@ BOOST_AUTO_TEST_CASE(parseRequest) {
"\r\n"
"testdata";
- map<string, string> tHeaders;
+ unordered_map<string, string> tHeaders;
string t = HttpParser::getInstance().parseRequest(data, tHeaders);
- map<string, string> eHeaders = {
+ unordered_map<string, string> eHeaders = {
{ "method", "POST" },
{ "path", "/index.html" },
{ "host", "example.com" },
@@ -118,10 +118,10 @@ BOOST_AUTO_TEST_CASE(parseResponse) {
"\r\n"
"testdata";
- map<string, string> tHeaders;
+ unordered_map<string, string> tHeaders;
string t = HttpParser::getInstance().parseResponse(data, tHeaders);
- map<string, string> eHeaders = {
+ unordered_map<string, string> eHeaders = {
{ "status", "200" },
{ "content-type", "text/plain" },
{ "content-length", "8" }