7
7
#include < boost/network/include/http/client.hpp>
8
8
#include < boost/test/unit_test.hpp>
9
9
#include < iostream>
10
- #include " client_types.hpp"
11
10
12
11
namespace net = boost::network;
13
12
namespace http = boost::network::http;
@@ -26,23 +25,28 @@ struct body_handler {
26
25
};
27
26
28
27
29
- BOOST_AUTO_TEST_CASE_TEMPLATE (http_client_get_streaming_test, client, async_only_client_types) {
30
- typename client::request request (" http://www.boost.org" );
31
- typename client::response response;
32
- typename client::string_type body_string;
33
- typename client::string_type dummy_body;
34
- body_handler handler_instance (body_string);
35
- {
36
- client client_;
37
- BOOST_CHECK_NO_THROW ( response = client_.get (request, http::_body_handler=handler_instance) );
38
- typename net::headers_range<typename client::response>::type range = headers (response)[" Content-Type" ];
39
- BOOST_CHECK ( !boost::empty (range) );
40
- BOOST_CHECK_EQUAL ( body (response).size (), 0u );
41
- BOOST_CHECK_EQUAL ( response.version ().substr (0 , 7 ), std::string (" HTTP/1." ) );
42
- BOOST_CHECK_EQUAL ( response.status (), 200u );
43
- BOOST_CHECK_EQUAL ( response.status_message (), std::string (" OK" ) );
44
- dummy_body = body (response);
45
- }
46
- BOOST_CHECK ( dummy_body == typename client::string_type () );
28
+ BOOST_AUTO_TEST_CASE (http_client_get_streaming_test) {
29
+ http::client::request request (" http://www.boost.org" );
30
+ http::client::response response;
31
+ std::string body_string;
32
+ std::string dummy_body;
33
+ body_handler handler_instance (body_string);
34
+ {
35
+ http::client client_;
36
+ BOOST_CHECK_NO_THROW ( response = client_.get (request, handler_instance) );
37
+ net::headers_wrapper::range_type range = headers (response)[" Content-Type" ];
38
+ BOOST_CHECK ( !boost::empty (range) );
39
+ BOOST_CHECK_EQUAL ( body (response).size (), 0u );
40
+ std::string version_, status_message_;
41
+ boost::uint16_t status_;
42
+ version_ = version (response);
43
+ status_ = status (response);
44
+ status_message_ = status_message (response);
45
+ BOOST_CHECK_EQUAL ( version_.substr (0 , 7 ), std::string (" HTTP/1." ) );
46
+ BOOST_CHECK_EQUAL ( status_, 200u );
47
+ BOOST_CHECK_EQUAL ( status_message_, std::string (" OK" ) );
48
+ dummy_body = body (response);
49
+ }
50
+ BOOST_CHECK ( dummy_body == std::string () );
47
51
}
48
52
0 commit comments