• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright (c) 2016-2019 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 // Official repository: https://github.com/boostorg/beast
8 //
9 
10 // Test that header file is self-contained.
11 #include <boost/beast/websocket/rfc6455.hpp>
12 
13 #include <boost/beast/_experimental/unit_test/suite.hpp>
14 
15 namespace boost {
16 namespace beast {
17 namespace websocket {
18 
19 class rfc6455_test
20     : public beast::unit_test::suite
21 {
22 public:
23     void
test_is_upgrade()24     test_is_upgrade()
25     {
26         http::header<true> req;
27         req.version(10);
28         BEAST_EXPECT(! is_upgrade(req));
29         req.version(11);
30         req.method(http::verb::post);
31         req.target("/");
32         BEAST_EXPECT(! is_upgrade(req));
33         req.method(http::verb::get);
34         req.insert("Connection", "upgrade");
35         BEAST_EXPECT(! is_upgrade(req));
36         req.insert("Upgrade", "websocket");
37         BEAST_EXPECT(is_upgrade(req));
38     }
39 
40     void
run()41     run() override
42     {
43         test_is_upgrade();
44     }
45 };
46 
47 BEAST_DEFINE_TESTSUITE(beast,websocket,rfc6455);
48 
49 } // websocket
50 } // beast
51 } // boost
52