mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
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:
@@ -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");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user