Browse Source

fix ExceptionHandlerTest.ContentLength

Kai Aoki 3 years ago
parent
commit
869f5bb279
1 changed files with 7 additions and 2 deletions
  1. 7 2
      test/test.cc

+ 7 - 2
test/test.cc

@@ -1249,8 +1249,13 @@ TEST(ExceptionHandlerTest, ContentLength) {
   Server svr;
 
   svr.set_exception_handler([](const Request & /*req*/, Response &res,
-                               std::exception &e) {
-    EXPECT_EQ("abc", std::string(e.what()));
+                               std::exception_ptr ep) {
+    EXPECT_FALSE(ep == nullptr);
+    try{
+      std::rethrow_exception(ep);
+    }catch(std::exception& e){
+      EXPECT_EQ("abc", std::string(e.what()));
+    }
     res.status = 500;
     res.set_content("abcdefghijklmnopqrstuvwxyz",
                     "text/html"); // <= Content-Length still 13 at this point