Skip to content

Commit 0728888

Browse files
committed
Code cleanup
1 parent 34d392c commit 0728888

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

httplib.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,6 @@ using socket_t = int;
231231
#include <string>
232232
#include <sys/stat.h>
233233
#include <thread>
234-
#include <type_traits>
235234
#include <unordered_map>
236235
#include <unordered_set>
237236
#include <utility>
@@ -874,7 +873,7 @@ class Server {
874873

875874
template <class ErrorHandlerFunc>
876875
Server &set_error_handler(ErrorHandlerFunc &&handler) {
877-
return set_error_handler_impl(
876+
return set_error_handler_core(
878877
std::forward<ErrorHandlerFunc>(handler),
879878
std::is_convertible<ErrorHandlerFunc, HandlerWithResponse>{});
880879
}
@@ -940,9 +939,6 @@ class Server {
940939
size_t payload_max_length_ = CPPHTTPLIB_PAYLOAD_MAX_LENGTH;
941940

942941
private:
943-
Server &set_error_handler_impl(HandlerWithResponse handler, std::true_type);
944-
Server &set_error_handler_impl(Handler handler, std::false_type);
945-
946942
using Handlers =
947943
std::vector<std::pair<std::unique_ptr<detail::MatcherBase>, Handler>>;
948944
using HandlersForContentReader =
@@ -952,6 +948,9 @@ class Server {
952948
static std::unique_ptr<detail::MatcherBase>
953949
make_matcher(const std::string &pattern);
954950

951+
Server &set_error_handler_core(HandlerWithResponse handler, std::true_type);
952+
Server &set_error_handler_core(Handler handler, std::false_type);
953+
955954
socket_t create_server_socket(const std::string &host, int port,
956955
int socket_flags,
957956
SocketOptions socket_options) const;
@@ -5817,13 +5816,13 @@ inline Server &Server::set_file_request_handler(Handler handler) {
58175816
return *this;
58185817
}
58195818

5820-
inline Server &Server::set_error_handler_impl(HandlerWithResponse handler,
5819+
inline Server &Server::set_error_handler_core(HandlerWithResponse handler,
58215820
std::true_type) {
58225821
error_handler_ = std::move(handler);
58235822
return *this;
58245823
}
58255824

5826-
inline Server &Server::set_error_handler_impl(Handler handler,
5825+
inline Server &Server::set_error_handler_core(Handler handler,
58275826
std::false_type) {
58285827
error_handler_ = [handler](const Request &req, Response &res) {
58295828
handler(req, res);

0 commit comments

Comments
 (0)