33// (See accompanying file LICENSE_1_0.txt or copy at
44// http://www.boost.org/LICENSE_1_0.txt)
55
6- #define BOOST_TEST_MODULE HTTP 1.0 Get Test
6+ #define BOOST_TEST_MODULE HTTP Get Test
77#include < boost/network/include/http/client.hpp>
88#include < boost/test/unit_test.hpp>
99#include " client_types.hpp"
@@ -16,10 +16,9 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(http_client_get_test, client, client_types) {
1616 client client_;
1717 typename client::response response;
1818 BOOST_REQUIRE_NO_THROW (response = client_.get (request));
19- typename net::headers_range<typename client::response>::type range =
20- headers (response)[" Content-Type" ];
2119 try {
2220 auto data = body (response);
21+ std::cout << data;
2322 } catch (...) {
2423 BOOST_ASSERT (false );
2524 }
@@ -34,12 +33,11 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(https_client_get_test, client, client_types) {
3433 typename client::request request (" https://www.github.com/" );
3534 client client_;
3635 typename client::response response = client_.get (request);
37- typename net::headers_range<typename client::response>::type range =
38- headers (response)[" Content-Type" ];
3936 BOOST_CHECK (response.status () == 200 ||
4037 (response.status () >= 300 && response.status () < 400 ));
4138 try {
4239 auto data = body (response);
40+ std::cout << data;
4341 } catch (...) {
4442 BOOST_ASSERT (false );
4543 }
@@ -48,14 +46,18 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(https_client_get_test, client, client_types) {
4846#endif
4947
5048BOOST_AUTO_TEST_CASE_TEMPLATE (http_temp_client_get_test, client, client_types) {
51- typename client::request request (" http://www.google.co.kr " );
49+ typename client::request request (" http://cpp-netlib.org/ " );
5250 typename client::response response;
5351 BOOST_REQUIRE_NO_THROW (response = client ().get (request));
54- typename net::headers_range<typename client::response>::type range =
55- headers (response)[" Content-Type" ];
52+ auto range = headers (response);
5653 BOOST_CHECK (!boost::empty (range));
57- BOOST_REQUIRE_NO_THROW (BOOST_CHECK (body (response).size () != 0 ));
54+ try {
55+ auto data = body (response);
56+ std::cout << data;
57+ } catch (...) {
58+ BOOST_ASSERT (false );
59+ }
5860 BOOST_CHECK_EQUAL (response.version ().substr (0 , 7 ), std::string (" HTTP/1." ));
59- BOOST_CHECK_EQUAL (response.status (), 200u );
60- BOOST_CHECK_EQUAL (response.status_message (), std::string ( " OK " ));
61+ BOOST_CHECK (response.status () == 200u ||
62+ (response.status () >= 300 && response. status () < 400 ));
6163}
0 commit comments