mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2025-05-15 01:08:27 +00:00
Changed to return 'Server&' from 'get' and 'post'
This commit is contained in:
parent
4d62b15d94
commit
1e3ef46862
2 changed files with 30 additions and 32 deletions
10
httplib.h
10
httplib.h
|
@ -133,8 +133,8 @@ public:
|
|||
Server();
|
||||
virtual ~Server();
|
||||
|
||||
void get(const char* pattern, Handler handler);
|
||||
void post(const char* pattern, Handler handler);
|
||||
Server& get(const char* pattern, Handler handler);
|
||||
Server& post(const char* pattern, Handler handler);
|
||||
|
||||
bool set_base_dir(const char* path);
|
||||
|
||||
|
@ -846,14 +846,16 @@ inline Server::~Server()
|
|||
{
|
||||
}
|
||||
|
||||
inline void Server::get(const char* pattern, Handler handler)
|
||||
inline Server& Server::get(const char* pattern, Handler handler)
|
||||
{
|
||||
get_handlers_.push_back(std::make_pair(std::regex(pattern), handler));
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline void Server::post(const char* pattern, Handler handler)
|
||||
inline Server& Server::post(const char* pattern, Handler handler)
|
||||
{
|
||||
post_handlers_.push_back(std::make_pair(std::regex(pattern), handler));
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline bool Server::set_base_dir(const char* path)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue