Skip to content

Commit

Permalink
Tweaking HTTPHandler some more
Browse files Browse the repository at this point in the history
  • Loading branch information
snej committed Sep 7, 2023
1 parent 8f47dab commit 08235a4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/HTTPHandler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,16 @@ namespace crouton {
Future<void> HTTPHandler::handleRequest(HTTPHeaders responseHeaders,
HandlerFunction const& handler)
{
string body = AWAIT _parser.entireBody(); //TODO: Let handler fn read at its own pace
Request request {
_parser.requestMethod,
_parser.requestURI.value(),
_parser.headers,
AWAIT _parser.entireBody()
std::move(body)
};
Response response(this, std::move(responseHeaders));
AWAIT handler(request, response);
Future<void> handled = handler(request, response); // split in 2 lines bc MSVC bug
AWAIT handled;
AWAIT response.finishHeaders();
AWAIT endBody();
RETURN;
Expand Down

0 comments on commit 08235a4

Please sign in to comment.