diff --git a/CHANGELOG.md b/CHANGELOG.md index 10802c98..3c88b317 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ Version 71: * Documentation revision * Fix spurious on_chunk invocation * Call prepare_payload in HTTP example +* Check trailers in test WebSockets: diff --git a/test/http/basic_parser.cpp b/test/http/basic_parser.cpp index af51212d..d34dcee2 100644 --- a/test/http/basic_parser.cpp +++ b/test/http/basic_parser.cpp @@ -1099,7 +1099,7 @@ public: bufgrind>( "HTTP/1.1 200 OK\r\n" "Server: test\r\n" - "Expect: Expires, MD5-Fingerprint\r\n" + "Trailer: Expires, MD5-Fingerprint\r\n" "Transfer-Encoding: chunked\r\n" "\r\n" "5\r\n" @@ -1110,9 +1110,11 @@ public: "Expires: never\r\n" "MD5-Fingerprint: -\r\n" "\r\n" - ,[&](test_parser const& p) + ,[&](test_parser& p) { BEAST_EXPECT(p.body == "*****--"); + BEAST_EXPECT(p.fields["Expires"] == "never"); + BEAST_EXPECT(p.fields["MD5-Fingerprint"] == "-"); }); } diff --git a/test/http/test_parser.hpp b/test/http/test_parser.hpp index 0892bdcd..4c8ad075 100644 --- a/test/http/test_parser.hpp +++ b/test/http/test_parser.hpp @@ -10,6 +10,8 @@ #include #include +#include +#include namespace beast { namespace http { @@ -37,6 +39,8 @@ public: bool got_content_length = false; bool got_on_chunk = false; bool got_on_complete = false; + std::unordered_map< + std::string, std::string> fields; test_parser() = default; @@ -79,14 +83,15 @@ public: } void - on_field(field, string_view, - string_view, error_code& ec) + on_field(field, string_view name, + string_view value, error_code& ec) { got_on_field = true; if(fc_) fc_->fail(ec); else ec.assign(0, ec.category()); + fields[name.to_string()] = value.to_string(); } void