]>
git.proxmox.com Git - ceph.git/blob - ceph/src/Beast/test/http/streambuf_body.cpp
2 // Copyright (c) 2013-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
4 // Distributed under the Boost Software License, Version 1.0. (See accompanying
5 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 // Test that header file is self-contained.
9 #include <beast/http/streambuf_body.hpp>
11 #include <beast/core/to_string.hpp>
12 #include <beast/http/fields.hpp>
13 #include <beast/http/message_parser.hpp>
14 #include <beast/http/read.hpp>
15 #include <beast/http/write.hpp>
16 #include <beast/test/string_istream.hpp>
17 #include <beast/unit_test/suite.hpp>
18 #include <boost/lexical_cast.hpp>
23 class streambuf_body_test
: public beast::unit_test::suite
25 boost::asio::io_service ios_
;
33 "Content-Length: 3\r\n"
36 test::string_istream
ss(ios_
, s
);
37 message_parser
<false, streambuf_body
, fields
> p
;
40 auto const& m
= p
.get();
41 BEAST_EXPECT(to_string(m
.body
.data()) == "xyz");
42 BEAST_EXPECT(boost::lexical_cast
<std::string
>(m
) == s
);
46 BEAST_DEFINE_TESTSUITE(streambuf_body
,http
,beast
);