diff options
author | ipkn <ipknhama@gmail.com> | 2015-05-09 23:28:30 +0900 |
---|---|---|
committer | ipkn <ipknhama@gmail.com> | 2015-05-09 23:28:30 +0900 |
commit | 9c1870c2a5e86808fc9380b72bed09975bdd3efe (patch) | |
tree | aea8aa1abd9466db3bf249bc8d937a97897d7314 /tests | |
parent | c94fc46a7a7b8a2947e3625edbfd5ee2c4ce9817 (diff) | |
parent | 243995f36f4ee40aa88c1d29b976b944a3d1ac74 (diff) | |
download | crow-9c1870c2a5e86808fc9380b72bed09975bdd3efe.tar.gz crow-9c1870c2a5e86808fc9380b72bed09975bdd3efe.zip |
Merge pull request #61 from bryce-anderson/params
Fix memory error and invalid param when no params are present
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unittest.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/unittest.cpp b/tests/unittest.cpp index 460abac..e1c440b 100644 --- a/tests/unittest.cpp +++ b/tests/unittest.cpp @@ -1,6 +1,7 @@ //#define CROW_ENABLE_LOGGING #define CROW_ENABLE_DEBUG #include <iostream> +#include <sstream> #include <vector> #include "settings.h" #undef CROW_LOG_LEVEL @@ -943,6 +944,20 @@ TEST(simple_url_params) asio::io_service is; std::string sendmsg; + // check empty params + sendmsg = "GET /params\r\n\r\n"; + { + asio::ip::tcp::socket c(is); + c.connect(asio::ip::tcp::endpoint(asio::ip::address::from_string("127.0.0.1"), 45451)); + c.send(asio::buffer(sendmsg)); + c.receive(asio::buffer(buf, 2048)); + c.close(); + + stringstream ss; + ss << last_url_params; + + ASSERT_EQUAL("[ ]", ss.str()); + } // check single presence sendmsg = "GET /params?foobar\r\n\r\n"; { |