Skip to content
Merged
Prev Previous commit
Refactored HTTP client request and response.
  • Loading branch information
glynos committed Apr 10, 2016
commit 1e14f3ceda1da12897a142d0d81307543d78e618
2 changes: 1 addition & 1 deletion boost/network/protocol/http/client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <boost/config.hpp>
#include <boost/network/protocol/http/message.hpp>
#include <boost/network/protocol/http/request.hpp>
#include <boost/network/protocol/http/response.hpp>
#include <boost/network/protocol/http/client/response.hpp>
#include <boost/network/traits/ostringstream.hpp>

#include <boost/algorithm/string/classification.hpp>
Expand Down
10 changes: 2 additions & 8 deletions boost/network/protocol/http/client/facade.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,13 @@
#include <memory>
#include <functional>
#include <boost/network/protocol/http/client/pimpl.hpp>
#include <boost/network/protocol/http/request.hpp>
#include <boost/network/protocol/http/response.hpp>
#include <boost/network/protocol/http/client/request.hpp>
#include <boost/network/protocol/http/client/response.hpp>

namespace boost {
namespace network {
namespace http {

template <class Tag>
struct basic_request;

template <class Tag>
struct basic_response;

template <class Tag, unsigned version_major, unsigned version_minor>
class basic_client_facade {
typedef basic_client_impl<Tag, version_major, version_minor> pimpl_type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

#if !defined(BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_REQUEST_INC)
#define BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_REQUEST_INC

#include <boost/network/protocol/http/impl/request.hpp>

namespace boost {
namespace network {
namespace http {
using client_request = basic_request<tags::http_async_8bit_tcp_resolve>;
} // namespace http
} // namespace network
} // namespace boost
} // namespace http
} // namespace network
} // namespace boost

#endif // BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_REQUEST_INC
19 changes: 19 additions & 0 deletions boost/network/protocol/http/client/response.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright 2016 Glyn Matthews.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

#if !defined(BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_RESPONSE_INC)
#define BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_RESPONSE_INC

#include <boost/network/protocol/http/response.hpp>

namespace boost {
namespace network {
namespace http {
using client_response = basic_response<tags::http_async_8bit_tcp_resolve>;
} // namespace http
} // namespace network
} // namespace boost

#endif // BOOST_NETWORK_PROTOCOL_HTTP_CLIENT_RESPONSE_INC
1 change: 0 additions & 1 deletion libs/network/test/http/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ if (Boost_FOUND)
${CPP-NETLIB_BINARY_DIR}/tests/cpp-netlib-http-${test})
endforeach (test)
set(TESTS
http_client_request_test
client_constructor_test
client_get_test
client_get_different_port_test
Expand Down
8 changes: 2 additions & 6 deletions libs/network/test/http/client/request_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,10 @@
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)


#include <gtest/gtest.h>
// #include <boost/network/protocol/http/client/request.hpp>
#include <boost/network/protocol/http/client.hpp>


using client_request = boost::network::http::client::request;
#include <boost/network/protocol/http/client/request.hpp>

using client_request = boost::network::http::client_request;

TEST(http_client_request, construct_from_uri) {
ASSERT_NO_THROW(client_request("http://cpp-netlib.org/"));
Expand Down
8 changes: 2 additions & 6 deletions libs/network/test/http/client/response_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,10 @@
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)


#include <gtest/gtest.h>
// #include <boost/network/protocol/http/client/response.hpp>
#include <boost/network/protocol/http/client.hpp>


using client_response = boost::network::http::client::response;
#include <boost/network/protocol/http/client/response.hpp>

using client_response = boost::network::http::client_response;

TEST(http_client_response, construct) {
ASSERT_NO_THROW(client_response());
Expand Down
14 changes: 0 additions & 14 deletions libs/network/test/http/http_client_request_test.cpp

This file was deleted.