Return error_code from beast::http::basic_parser:

This changes the HTTP parser interface to return an error_code instead
of a bool. This eliminates the need for the error() member function and
simplifies calling code.
This commit is contained in:
Vinnie Falco
2014-10-12 19:10:33 -07:00
parent 88cb0a1f7a
commit 3cd391daa6
3 changed files with 41 additions and 43 deletions

View File

@@ -67,9 +67,9 @@ public:
message m;
parser p (m, true);
auto result (p.write (boost::asio::buffer(text)));
expect (result.first);
expect (! result.first);
auto result2 (p.write_eof());
expect (result2);
expect (! result2);
expect (p.complete());
}
@@ -81,9 +81,9 @@ public:
;
message m;
parser p (m, true);
auto result (p.write (boost::asio::buffer(text)));
if (expect (! result.first))
expect (p.error().message() == "invalid HTTP method");
auto result = p.write (boost::asio::buffer(text));
if (expect (result.first))
expect (result.first.message() == "invalid HTTP method");
}
}
};