summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libadhocutil/unittests/testCurl.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/libadhocutil/unittests/testCurl.cpp b/libadhocutil/unittests/testCurl.cpp
index 1a8a595..ba7cfcf 100644
--- a/libadhocutil/unittests/testCurl.cpp
+++ b/libadhocutil/unittests/testCurl.cpp
@@ -7,6 +7,7 @@
#include "curlStream.h"
#include "definedDirs.h"
#include "net.h"
+#include <boost/algorithm/string/predicate.hpp>
using namespace AdHoc::Net;
@@ -56,6 +57,23 @@ BOOST_AUTO_TEST_CASE( fetch_missing )
BOOST_REQUIRE_THROW(ch.perform(), AdHoc::Net::CurlException);
}
+BOOST_AUTO_TEST_CASE( fetch_http_stream )
+{
+ CurlStreamSource css("http://sys.randomdan.homeip.net/env.cgi");
+ css.appendHeader("X-POWERED-BY: mature-cheddar");
+ CurlStream curlstrm(css);
+ std::string tok;
+ int expected = 0;
+ while (!curlstrm.eof()) {
+ curlstrm >> tok;
+ if (boost::algorithm::starts_with(tok, "HTTP_X_POWERED_BY=")) {
+ expected += 1;
+ BOOST_REQUIRE_EQUAL("HTTP_X_POWERED_BY=mature-cheddar", tok);
+ }
+ }
+ BOOST_REQUIRE_EQUAL(1, expected);
+}
+
BOOST_AUTO_TEST_CASE( fetch_file_stream )
{
auto url = "file://" + rootDir.string() + "/testCurl.cpp";