Removed unused lambda captures in examples
This commit is contained in:
parent
7a1a23bf9c
commit
3f8fcc0c31
2 changed files with 4 additions and 4 deletions
|
|
@ -89,13 +89,13 @@ int main() {
|
||||||
|
|
||||||
//GET-example for the path /match/[number], responds with the matched string in path (number)
|
//GET-example for the path /match/[number], responds with the matched string in path (number)
|
||||||
//For instance a request GET /match/123 will receive: 123
|
//For instance a request GET /match/123 will receive: 123
|
||||||
server.resource["^/match/([0-9]+)$"]["GET"]=[&server](shared_ptr<HttpServer::Response> response, shared_ptr<HttpServer::Request> request) {
|
server.resource["^/match/([0-9]+)$"]["GET"]=[](shared_ptr<HttpServer::Response> response, shared_ptr<HttpServer::Request> request) {
|
||||||
string number=request->path_match[1];
|
string number=request->path_match[1];
|
||||||
*response << "HTTP/1.1 200 OK\r\nContent-Length: " << number.length() << "\r\n\r\n" << number;
|
*response << "HTTP/1.1 200 OK\r\nContent-Length: " << number.length() << "\r\n\r\n" << number;
|
||||||
};
|
};
|
||||||
|
|
||||||
//Get example simulating heavy work in a separate thread
|
//Get example simulating heavy work in a separate thread
|
||||||
server.resource["^/work$"]["GET"]=[&server](shared_ptr<HttpServer::Response> response, shared_ptr<HttpServer::Request> /*request*/) {
|
server.resource["^/work$"]["GET"]=[](shared_ptr<HttpServer::Response> response, shared_ptr<HttpServer::Request> /*request*/) {
|
||||||
thread work_thread([response] {
|
thread work_thread([response] {
|
||||||
this_thread::sleep_for(chrono::seconds(5));
|
this_thread::sleep_for(chrono::seconds(5));
|
||||||
string message="Work done";
|
string message="Work done";
|
||||||
|
|
|
||||||
|
|
@ -87,13 +87,13 @@ int main() {
|
||||||
|
|
||||||
//GET-example for the path /match/[number], responds with the matched string in path (number)
|
//GET-example for the path /match/[number], responds with the matched string in path (number)
|
||||||
//For instance a request GET /match/123 will receive: 123
|
//For instance a request GET /match/123 will receive: 123
|
||||||
server.resource["^/match/([0-9]+)$"]["GET"]=[&server](shared_ptr<HttpsServer::Response> response, shared_ptr<HttpsServer::Request> request) {
|
server.resource["^/match/([0-9]+)$"]["GET"]=[](shared_ptr<HttpsServer::Response> response, shared_ptr<HttpsServer::Request> request) {
|
||||||
string number=request->path_match[1];
|
string number=request->path_match[1];
|
||||||
*response << "HTTP/1.1 200 OK\r\nContent-Length: " << number.length() << "\r\n\r\n" << number;
|
*response << "HTTP/1.1 200 OK\r\nContent-Length: " << number.length() << "\r\n\r\n" << number;
|
||||||
};
|
};
|
||||||
|
|
||||||
//Get example simulating heavy work in a separate thread
|
//Get example simulating heavy work in a separate thread
|
||||||
server.resource["^/work$"]["GET"]=[&server](shared_ptr<HttpsServer::Response> response, shared_ptr<HttpsServer::Request> /*request*/) {
|
server.resource["^/work$"]["GET"]=[](shared_ptr<HttpsServer::Response> response, shared_ptr<HttpsServer::Request> /*request*/) {
|
||||||
thread work_thread([response] {
|
thread work_thread([response] {
|
||||||
this_thread::sleep_for(chrono::seconds(5));
|
this_thread::sleep_for(chrono::seconds(5));
|
||||||
string message="Work done";
|
string message="Work done";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue