9
9
#include < boost/test/unit_test.hpp>
10
10
#include < boost/network/include/http/client.hpp>
11
11
#include < iostream>
12
+ #include < boost/mpl/integral_c.hpp>
13
+ #include < boost/mpl/if.hpp>
12
14
#include < boost/mpl/list.hpp>
15
+ #include < boost/network/support/is_async.hpp>
13
16
14
17
using namespace boost ::network;
15
18
@@ -46,7 +49,7 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(http_get_test_timeout, T, tag_types) {
46
49
typename client::response response_;
47
50
boost::uint16_t port_ =port (request);
48
51
BOOST_CHECK_EQUAL (12121 , port_ );
49
- BOOST_CHECK_THROW ( response_ = client_.get (request), boost::system::system_error );
52
+ BOOST_CHECK_THROW ( response_ = client_.get (request); body (response_); , boost::system::system_error );
50
53
}
51
54
52
55
BOOST_AUTO_TEST_CASE_TEMPLATE (http_get_details, T, tag_types) {
@@ -70,12 +73,21 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(http_cached_resolve, T, tag_types) {
70
73
BOOST_CHECK_NO_THROW ( response_ = client_.get (other_request) );
71
74
}
72
75
76
+ template <class Tag >
77
+ struct status_ :
78
+ boost::mpl::if_<
79
+ boost::network::is_async<Tag>,
80
+ boost::mpl::integral_c<boost::uint16_t ,301u >,
81
+ boost::mpl::integral_c<boost::uint16_t ,200u >
82
+ >::type
83
+ {};
84
+
73
85
BOOST_AUTO_TEST_CASE_TEMPLATE (http_redirection_test, T, tag_types) {
74
86
typedef http::basic_client<T,1 ,0 > client;
75
87
typename client::requestrequest (" http://boost.org" );
76
88
clientclient_ (client::follow_redirect);
77
89
typename client::response response_;
78
90
BOOST_CHECK_NO_THROW ( response_ = client_.get (request) );
79
- BOOST_CHECK_EQUAL ( response_.status (),200u );
91
+ BOOST_CHECK_EQUAL ( response_.status (),status_<T>::value );
80
92
}
81
93