forked from glynos/cpp-netlib
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Long road to functional http::request.
One of the larger casualties of this refactor is http::request which has been turned into a pimpl'ed value type. The implementation still has a heavy-weight copy but at some point we can actually go ahead and do some "copy-on-write" behavior if we really want to. For now we're going to cover all the supported public APIs for the http::request object. Once we're done with that we can then continue to debugging, testing, and mocking out certain parts for the HTTP client objects. I have a sneaking suspicion that if we get done with the http::request and http::response objects then the HTTP clients might "just work".
- Loading branch information
1 parent
1df7415
commit 2c69f64
Showing
5 changed files
with
83 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright 2012 Dean Michael Berris <dberris@google.com>. | ||
// Copyright 2012 Google, Inc. | ||
// 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) | ||
|
||
#define BOOST_TEST_MODULE HTTP Request Test | ||
#include <boost/network/protocol/http/request.hpp> | ||
#include <boost/test/unit_test.hpp> | ||
|
||
namespace http = boost::network::http; | ||
|
||
BOOST_AUTO_TEST_CASE(request_construction) { | ||
http::request request; | ||
http::request other(request); | ||
} | ||
|
||
BOOST_AUTO_TEST_CASE(request_uri_test) { | ||
http::request request; | ||
request.set_uri("http://www.google.com/"); | ||
http::request other(request); | ||
std::string original, copied; | ||
request.get_uri(original); | ||
other.get_uri(copied); | ||
BOOST_CHECK_EQUAL(std::string("http://www.google.com/"), original); | ||
BOOST_CHECK_EQUAL(original, copied); | ||
} |