From 6f58dc728f6f30df6c5b17c8f2cbdb887ff41077 Mon Sep 17 00:00:00 2001 From: yhirose Date: Thu, 28 Nov 2019 08:27:10 -0500 Subject: [PATCH] Fixed problem with requests with no content --- httplib.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/httplib.h b/httplib.h index 3bad9f6..002b874 100644 --- a/httplib.h +++ b/httplib.h @@ -2819,8 +2819,10 @@ inline bool Server::routing(Request &req, Response &res, Stream &strm, bool last } // Read content into `req.body` - if (!read_content(strm, last_connection, req, res)) { - return false; + if (req.method == "POST" || req.method == "PUT" || req.method == "PATCH" || req.method == "PRI") { + if (!read_content(strm, last_connection, req, res)) { + return false; + } } // Regular handler