mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2025-05-15 09:18:27 +00:00
Resolve #1100
This commit is contained in:
parent
ea7548b4cc
commit
226388ae27
3 changed files with 26 additions and 2 deletions
10
test/test.cc
10
test/test.cc
|
@ -37,8 +37,12 @@ MultipartFormData &get_file_value(MultipartFormDataItems &files,
|
|||
auto it = std::find_if(
|
||||
files.begin(), files.end(),
|
||||
[&](const MultipartFormData &file) { return file.name == key; });
|
||||
#ifdef CPPHTTPLIB_NO_EXCEPTIONS
|
||||
return *it;
|
||||
#else
|
||||
if (it != files.end()) { return *it; }
|
||||
throw std::runtime_error("invalid mulitpart form data name error");
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST(ConstructorTest, MoveConstructible) {
|
||||
|
@ -1187,6 +1191,7 @@ TEST(ErrorHandlerTest, ContentLength) {
|
|||
ASSERT_FALSE(svr.is_running());
|
||||
}
|
||||
|
||||
#ifndef CPPHTTPLIB_NO_EXCEPTIONS
|
||||
TEST(ExceptionHandlerTest, ContentLength) {
|
||||
Server svr;
|
||||
|
||||
|
@ -1222,6 +1227,7 @@ TEST(ExceptionHandlerTest, ContentLength) {
|
|||
thread.join();
|
||||
ASSERT_FALSE(svr.is_running());
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST(NoContentTest, ContentLength) {
|
||||
Server svr;
|
||||
|
@ -3681,6 +3687,7 @@ TEST(MountTest, Unmount) {
|
|||
ASSERT_FALSE(svr.is_running());
|
||||
}
|
||||
|
||||
#ifndef CPPHTTPLIB_NO_EXCEPTIONS
|
||||
TEST(ExceptionTest, ThrowExceptionInHandler) {
|
||||
Server svr;
|
||||
|
||||
|
@ -3709,6 +3716,7 @@ TEST(ExceptionTest, ThrowExceptionInHandler) {
|
|||
listen_thread.join();
|
||||
ASSERT_FALSE(svr.is_running());
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST(KeepAliveTest, ReadTimeout) {
|
||||
Server svr;
|
||||
|
@ -4515,9 +4523,11 @@ TEST(NoSSLSupport, SimpleInterface) {
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifndef CPPHTTPLIB_NO_EXCEPTIONS
|
||||
TEST(InvalidScheme, SimpleInterface) {
|
||||
ASSERT_ANY_THROW(Client cli("scheme://yahoo.com"));
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST(NoScheme, SimpleInterface) {
|
||||
Client cli("yahoo.com:80");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue