Get HTTP working, kind of

This commit is contained in:
Alex Hultman
2018-09-10 23:28:51 +02:00
parent 549c97363c
commit cc284e0861
7 changed files with 33 additions and 27 deletions
+4 -2
View File
@@ -57,9 +57,11 @@ int main(int argc, char **argv) {
HttpContext<false> *httpContext = HttpContext<false>::create(loop.loop);
// req, res?
httpContext->onGet("/", [](auto *res) { // maybe use the terminology of HttpRequest for both?
httpContext->onGet("/", [](auto *res, auto *req) { // maybe use the terminology of HttpRequest for both?
std::cout << "Why hello! How do we access the headers?" << std::endl;
std::cout << "URL: <" << req->getUrl() << ">" << std::endl;
std::cout << "Query: <" << req->getQuery() << ">" << std::endl;
std::cout << "User-Agent: <" << req->getHeader("user-agent") << ">" << std::endl;
// read some data being passed
res->read([](std::string_view chunk) {