From 6d1a6ba1bdbcb32ad5f40088ac89b518824418ec Mon Sep 17 00:00:00 2001 From: Alex Hultman Date: Thu, 26 Dec 2019 01:03:50 +0100 Subject: [PATCH] Make it compile, lowercase methods --- src/App.h | 9 +++++---- src/HttpRouter.h | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/App.h b/src/App.h index e4677f0..e11f7b2 100644 --- a/src/App.h +++ b/src/App.h @@ -149,7 +149,7 @@ public: webSocketContext->getExt()->idleTimeout = behavior.idleTimeout; webSocketContext->getExt()->maxBackpressure = behavior.maxBackpressure; - return std::move(get(pattern, [webSocketContext, httpContext = this->httpContext, behavior = std::move(behavior)](auto *res, auto *req) mutable { + httpContext->onHttp("get", pattern, [webSocketContext, httpContext = this->httpContext, behavior = std::move(behavior)](auto *res, auto *req) mutable { /* If we have this header set, it's a websocket */ std::string_view secWebSocketKey = req->getHeader("sec-websocket-key"); @@ -248,11 +248,12 @@ public: /* Tell the router that we did not handle this request */ req->setYield(true); } - }, true)); + }, true); + return std::move(*this); } - TemplatedApp &&get(std::string pattern, fu2::unique_function *, HttpRequest *)> &&handler, bool upgrade = false) { - httpContext->onHttp("get", pattern, std::move(handler), upgrade); + TemplatedApp &&get(std::string pattern, fu2::unique_function *, HttpRequest *)> &&handler) { + httpContext->onHttp("get", pattern, std::move(handler)); return std::move(*this); } diff --git a/src/HttpRouter.h b/src/HttpRouter.h index c9e607f..3bd2aad 100644 --- a/src/HttpRouter.h +++ b/src/HttpRouter.h @@ -40,7 +40,7 @@ struct HttpRouter { USERDATA userData; - std::vector methods = {"GET", "POST", "HEAD", "PUT", "DELETE", "CONNECT", "OPTIONS", "TRACE", "PATCH"}; + std::vector methods = {"get", "post", "head", "put", "delete", "connect", "options", "trace", "patch"}; /* 32-bit */ const static uint32_t HANDLER_MASK = 0x0fffffff;