From 869f5bb2794c0c2fb458fae898e20c0f179ffc88 Mon Sep 17 00:00:00 2001 From: Kai Aoki Date: Fri, 15 Jul 2022 11:50:26 +0900 Subject: [PATCH] fix ExceptionHandlerTest.ContentLength --- test/test.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/test.cc b/test/test.cc index 3f94e58..6bd3330 100644 --- a/test/test.cc +++ b/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