This is an automated email from the ASF dual-hosted git repository.

fgerlits pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git

commit a2de3314cd1a343d95bb4a85a8440e7726f1aae4
Author: Adam Markovics <[email protected]>
AuthorDate: Thu Aug 4 10:31:23 2022 +0200

    MINIFICPP-1898 - Fix ListenHTTP test failure
    
    Signed-off-by: Ferenc Gerlits <[email protected]>
    This closes #1381
---
 extensions/civetweb/processors/ListenHTTP.cpp | 14 ++++++++++++++
 extensions/civetweb/processors/ListenHTTP.h   |  2 ++
 extensions/civetweb/tests/ListenHTTPTests.cpp |  2 +-
 3 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/extensions/civetweb/processors/ListenHTTP.cpp 
b/extensions/civetweb/processors/ListenHTTP.cpp
index 888186f5a..a790d0436 100644
--- a/extensions/civetweb/processors/ListenHTTP.cpp
+++ b/extensions/civetweb/processors/ListenHTTP.cpp
@@ -410,6 +410,20 @@ bool ListenHTTP::Handler::handleHead(CivetServer* 
/*server*/, struct mg_connecti
   return true;
 }
 
+bool ListenHTTP::Handler::handlePut(CivetServer* /*server*/, struct 
mg_connection* conn) {
+  mg_printf(conn, "HTTP/1.1 405 Method Not Allowed\r\n"
+                  "Content-Type: text/html\r\n"
+                  "Content-Length: 0\r\n\r\n");
+  return true;
+}
+
+bool ListenHTTP::Handler::handleDelete(CivetServer* /*server*/, struct 
mg_connection* conn) {
+  mg_printf(conn, "HTTP/1.1 405 Method Not Allowed\r\n"
+                  "Content-Type: text/html\r\n"
+                  "Content-Length: 0\r\n\r\n");
+  return true;
+}
+
 void ListenHTTP::Handler::setResponseBody(const ResponseBody& response) {
   std::lock_guard<std::mutex> guard(uri_map_mutex_);
 
diff --git a/extensions/civetweb/processors/ListenHTTP.h 
b/extensions/civetweb/processors/ListenHTTP.h
index c91adc2d3..d8a647038 100644
--- a/extensions/civetweb/processors/ListenHTTP.h
+++ b/extensions/civetweb/processors/ListenHTTP.h
@@ -114,6 +114,8 @@ class ListenHTTP : public core::Processor {
     bool handlePost(CivetServer *server, struct mg_connection *conn) override;
     bool handleGet(CivetServer *server, struct mg_connection *conn) override;
     bool handleHead(CivetServer *server, struct mg_connection *conn) override;
+    bool handlePut(CivetServer *server, struct mg_connection *conn) override;
+    bool handleDelete(CivetServer *server, struct mg_connection *conn) 
override;
 
     /**
      * Sets a static response body string to be used for a given URI, with a 
number of seconds it will be kept in memory.
diff --git a/extensions/civetweb/tests/ListenHTTPTests.cpp 
b/extensions/civetweb/tests/ListenHTTPTests.cpp
index e9ee3ee43..7592ec755 100644
--- a/extensions/civetweb/tests/ListenHTTPTests.cpp
+++ b/extensions/civetweb/tests/ListenHTTPTests.cpp
@@ -180,7 +180,7 @@ class ListenHTTPTestsFixture {
     if (endpoint == "test") {
       REQUIRE("Hello response body" == response_body);
     } else {
-      REQUIRE("" == response_body);
+      REQUIRE(response_body.empty());
     }
   }
 

Reply via email to