@@ -37,8 +37,12 @@ MultipartFormData &get_file_value(MultipartFormDataItems &files,
3737 auto it = std::find_if (
3838 files.begin (), files.end (),
3939 [&](const MultipartFormData &file) { return file.name == key; });
40+ #ifdef CPPHTTPLIB_NO_EXCEPTIONS
41+ return *it;
42+ #else
4043 if (it != files.end ()) { return *it; }
4144 throw std::runtime_error (" invalid mulitpart form data name error" );
45+ #endif
4246}
4347
4448TEST (ConstructorTest, MoveConstructible) {
@@ -1187,6 +1191,7 @@ TEST(ErrorHandlerTest, ContentLength) {
11871191 ASSERT_FALSE (svr.is_running ());
11881192}
11891193
1194+ #ifndef CPPHTTPLIB_NO_EXCEPTIONS
11901195TEST (ExceptionHandlerTest, ContentLength) {
11911196 Server svr;
11921197
@@ -1222,6 +1227,7 @@ TEST(ExceptionHandlerTest, ContentLength) {
12221227 thread.join ();
12231228 ASSERT_FALSE (svr.is_running ());
12241229}
1230+ #endif
12251231
12261232TEST (NoContentTest, ContentLength) {
12271233 Server svr;
@@ -3681,6 +3687,7 @@ TEST(MountTest, Unmount) {
36813687 ASSERT_FALSE (svr.is_running ());
36823688}
36833689
3690+ #ifndef CPPHTTPLIB_NO_EXCEPTIONS
36843691TEST (ExceptionTest, ThrowExceptionInHandler) {
36853692 Server svr;
36863693
@@ -3709,6 +3716,7 @@ TEST(ExceptionTest, ThrowExceptionInHandler) {
37093716 listen_thread.join ();
37103717 ASSERT_FALSE (svr.is_running ());
37113718}
3719+ #endif
37123720
37133721TEST (KeepAliveTest, ReadTimeout) {
37143722 Server svr;
@@ -4515,9 +4523,11 @@ TEST(NoSSLSupport, SimpleInterface) {
45154523}
45164524#endif
45174525
4526+ #ifndef CPPHTTPLIB_NO_EXCEPTIONS
45184527TEST (InvalidScheme, SimpleInterface) {
45194528 ASSERT_ANY_THROW (Client cli (" scheme://yahoo.com" ));
45204529}
4530+ #endif
45214531
45224532TEST (NoScheme, SimpleInterface) {
45234533 Client cli (" yahoo.com:80" );
0 commit comments