]>
Commit | Line | Data |
---|---|---|
7c673cae | 1 | // |
92f5a8d4 | 2 | // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) |
7c673cae FG |
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 | // | |
b32b8144 FG |
7 | // Official repository: https://github.com/boostorg/beast |
8 | // | |
7c673cae FG |
9 | |
10 | // Test that header file is self-contained. | |
b32b8144 | 11 | #include <boost/beast/http/buffer_body.hpp> |
92f5a8d4 TL |
12 | |
13 | #include <boost/beast/core/flat_buffer.hpp> | |
14 | #include <boost/beast/core/ostream.hpp> | |
15 | #include <boost/beast/http/parser.hpp> | |
16 | #include <boost/beast/http/read.hpp> | |
17 | ||
18 | #include <boost/beast/_experimental/unit_test/suite.hpp> | |
19 | #include <boost/beast/_experimental/test/stream.hpp> | |
20 | ||
21 | namespace boost { | |
22 | namespace beast { | |
23 | namespace http { | |
24 | ||
25 | class buffer_body_test : public beast::unit_test::suite | |
26 | { | |
27 | public: | |
28 | void | |
29 | testIssue1717() | |
30 | { | |
31 | net::io_context ioc; | |
32 | test::stream ts{ioc}; | |
33 | ostream(ts.buffer()) << | |
34 | "HTTP/1.1 200 OK\r\n" | |
35 | "Content-Length:3\r\n" | |
36 | "\r\n" | |
37 | "1.0"; | |
38 | error_code ec; | |
39 | flat_buffer fb; | |
40 | response_parser<buffer_body> p; | |
41 | char buf[256]; | |
42 | p.get().body().data = buf; | |
43 | p.get().body().size = sizeof(buf); | |
44 | read_header(ts, fb, p, ec); | |
45 | auto const bytes_transferred = | |
46 | read(ts, fb, p, ec); | |
47 | BEAST_EXPECTS(! ec, ec.message()); | |
48 | ||
49 | // VFALCO What should the read algorithms return? | |
50 | //BEAST_EXPECT(bytes_transferred == 3); | |
51 | } | |
52 | ||
53 | void | |
54 | run() override | |
55 | { | |
56 | testIssue1717(); | |
57 | } | |
58 | }; | |
59 | ||
60 | BEAST_DEFINE_TESTSUITE(beast,http,buffer_body); | |
61 | ||
62 | } // http | |
63 | } // beast | |
64 | } // boost |