6
6
#define BOOST_TEST_MODULE HTTP 1.0 Get Test
7
7
#include < boost/network/include/http/client.hpp>
8
8
#include < boost/test/unit_test.hpp>
9
- #include " tag_types .hpp"
9
+ #include " client_types .hpp"
10
10
11
11
namespace net = boost::network;
12
12
namespace http = boost::network::http;
13
13
14
- BOOST_AUTO_TEST_CASE_TEMPLATE (http_client_get_test, T, tag_types) {
15
- typedef http::basic_client<T, 1 , 0 > client;
14
+ BOOST_AUTO_TEST_CASE_TEMPLATE (http_client_get_test, client, client_types) {
16
15
typename client::request request (" http://www.boost.org" );
17
16
client client_;
18
17
typename client::response response;
@@ -25,38 +24,13 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(http_client_get_test, T, tag_types) {
25
24
BOOST_CHECK_EQUAL ( response.status_message (), std::string (" OK" ) );
26
25
}
27
26
28
- BOOST_AUTO_TEST_CASE_TEMPLATE (http_get_test, T, tag_types) {
29
- typedef http::basic_client<T, 1 , 1 > client;
30
- typename client::request request (" http://www.boost.org/" );
31
- typename client::response response_;
32
- client client_;
33
- BOOST_CHECK_NO_THROW ( response_ = client_.get (request) );
34
- typename net::headers_range<typename client::response>::type range = headers (response_)[" Content-Type" ];
35
- BOOST_CHECK ( boost::begin (range) != boost::end (range) );
36
- BOOST_CHECK ( body (response_).size () != 0 );
37
- BOOST_CHECK_EQUAL ( response_.version ().substr (0 ,7 ), std::string (" HTTP/1." ) );
38
- BOOST_CHECK_EQUAL ( response_.status (), 200u );
39
- BOOST_CHECK_EQUAL ( response_.status_message (), std::string (" OK" ) );
40
- }
41
-
42
27
#ifdef BOOST_NETWORK_ENABLE_HTTPS
43
28
44
- BOOST_AUTO_TEST_CASE_TEMPLATE (https_get_test_1_0, T, tag_types) {
45
- typedef http::basic_client<T, 1 , 0 > client;
46
- typename client::request request (" https://www.google.com/" );
47
- client client_;
48
- typename client::response response_ = client_.get (request);
49
- typename net::headers_range<typename http::basic_response<T> >::type range = headers (response_)[" Content-Type" ];
50
- BOOST_CHECK ( boost::begin (range) != boost::end (range) );
51
- BOOST_CHECK ( body (response_).size () != 0 );
52
- }
53
-
54
- BOOST_AUTO_TEST_CASE_TEMPLATE (https_get_test_1_1, T, tag_types) {
55
- typedef http::basic_client<T, 1 , 1 > client;
29
+ BOOST_AUTO_TEST_CASE_TEMPLATE (https_client_get_test, client, client_types) {
56
30
typename client::request request (" https://www.google.com/" );
57
31
client client_;
58
32
typename client::response response_ = client_.get (request);
59
- typename net::headers_range<typename http::basic_response<T> >::type range = headers (response_)[" Content-Type" ];
33
+ typename net::headers_range<typename client::response >::type range = headers (response_)[" Content-Type" ];
60
34
BOOST_CHECK ( boost::begin (range) != boost::end (range) );
61
35
BOOST_CHECK ( body (response_).size () != 0 );
62
36
}
0 commit comments