]> git.proxmox.com Git - ceph.git/blame - ceph/src/Beast/test/http/streambuf_body.cpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / Beast / test / http / streambuf_body.cpp
CommitLineData
7c673cae
FG
1//
2// Copyright (c) 2013-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
3//
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)
6//
7
8// Test that header file is self-contained.
9#include <beast/http/streambuf_body.hpp>
10
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>
19
20namespace beast {
21namespace http {
22
23class streambuf_body_test : public beast::unit_test::suite
24{
25 boost::asio::io_service ios_;
26
27public:
28 void run() override
29 {
30 std::string const s =
31 "HTTP/1.1 200 OK\r\n"
32 "Server: test\r\n"
33 "Content-Length: 3\r\n"
34 "\r\n"
35 "xyz";
36 test::string_istream ss(ios_, s);
37 message_parser<false, streambuf_body, fields> p;
38 streambuf sb;
39 read(ss, sb, 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);
43 }
44};
45
46BEAST_DEFINE_TESTSUITE(streambuf_body,http,beast);
47
48} // http
49} // beast