Files
boost_beast/test/websocket/rfc6455.cpp

54 lines
1.3 KiB
C++
Raw Normal View History

2017-07-20 08:01:46 -07:00
//
2017-07-24 09:42:36 -07:00
// Copyright (c) 2016-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
2017-07-20 08:01:46 -07:00
//
// 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)
//
2017-07-20 13:40:34 -07:00
// Official repository: https://github.com/boostorg/beast
//
2017-07-20 08:01:46 -07:00
// Test that header file is self-contained.
2017-07-20 13:40:34 -07:00
#include <boost/beast/websocket/rfc6455.hpp>
2017-07-20 13:40:34 -07:00
#include <boost/beast/unit_test/suite.hpp>
2017-07-20 13:40:34 -07:00
namespace boost {
namespace beast {
namespace websocket {
class rfc6455_test
: public beast::unit_test::suite
{
public:
void
test_is_upgrade()
{
http::header<true> req;
req.version = 10;
2017-07-20 13:40:34 -07:00
BOOST_BEAST_EXPECT(! is_upgrade(req));
req.version = 11;
req.method(http::verb::post);
req.target("/");
2017-07-20 13:40:34 -07:00
BOOST_BEAST_EXPECT(! is_upgrade(req));
req.method(http::verb::get);
2017-06-05 19:28:17 -07:00
req.insert("Connection", "upgrade");
2017-07-20 13:40:34 -07:00
BOOST_BEAST_EXPECT(! is_upgrade(req));
2017-06-05 19:28:17 -07:00
req.insert("Upgrade", "websocket");
2017-07-20 13:40:34 -07:00
BOOST_BEAST_EXPECT(! is_upgrade(req));
2017-06-05 19:28:17 -07:00
req.insert("Sec-WebSocket-Version", "13");
2017-07-20 13:40:34 -07:00
BOOST_BEAST_EXPECT(is_upgrade(req));
}
void
run() override
{
test_is_upgrade();
}
};
2017-07-20 13:40:34 -07:00
BOOST_BEAST_DEFINE_TESTSUITE(rfc6455,websocket,beast);
} // websocket
} // beast
2017-07-20 13:40:34 -07:00
} // boost