Applied style format
This commit is contained in:
parent
a0cc9e81c7
commit
14c0e3a3a3
3 changed files with 14 additions and 7 deletions
|
|
@ -54,7 +54,8 @@ namespace SimpleWeb {
|
||||||
namespace boost {
|
namespace boost {
|
||||||
#endif
|
#endif
|
||||||
namespace asio {
|
namespace asio {
|
||||||
template <> struct is_match_condition<SimpleWeb::HeaderEndMatch> : public std::true_type {};
|
template <>
|
||||||
|
struct is_match_condition<SimpleWeb::HeaderEndMatch> : public std::true_type {};
|
||||||
} // namespace asio
|
} // namespace asio
|
||||||
#ifndef USE_STANDALONE_ASIO
|
#ifndef USE_STANDALONE_ASIO
|
||||||
} // namespace boost
|
} // namespace boost
|
||||||
|
|
|
||||||
|
|
@ -214,7 +214,8 @@ int main() {
|
||||||
server_port.set_value(port);
|
server_port.set_value(port);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
cout << "Server listening on port " << server_port.get_future().get() << endl << endl;
|
cout << "Server listening on port " << server_port.get_future().get() << endl
|
||||||
|
<< endl;
|
||||||
|
|
||||||
// Client examples
|
// Client examples
|
||||||
string json_string = "{\"firstName\": \"John\",\"lastName\": \"Smith\",\"age\": 25}";
|
string json_string = "{\"firstName\": \"John\",\"lastName\": \"Smith\",\"age\": 25}";
|
||||||
|
|
@ -225,11 +226,13 @@ int main() {
|
||||||
try {
|
try {
|
||||||
cout << "Example GET request to http://localhost:8080/match/123" << endl;
|
cout << "Example GET request to http://localhost:8080/match/123" << endl;
|
||||||
auto r1 = client.request("GET", "/match/123");
|
auto r1 = client.request("GET", "/match/123");
|
||||||
cout << "Response content: " << r1->content.rdbuf() << endl << endl; // Alternatively, use the convenience function r1->content.string()
|
cout << "Response content: " << r1->content.rdbuf() << endl // Alternatively, use the convenience function r1->content.string()
|
||||||
|
<< endl;
|
||||||
|
|
||||||
cout << "Example POST request to http://localhost:8080/string" << endl;
|
cout << "Example POST request to http://localhost:8080/string" << endl;
|
||||||
auto r2 = client.request("POST", "/string", json_string);
|
auto r2 = client.request("POST", "/string", json_string);
|
||||||
cout << "Response content: " << r2->content.rdbuf() << endl << endl;
|
cout << "Response content: " << r2->content.rdbuf() << endl
|
||||||
|
<< endl;
|
||||||
}
|
}
|
||||||
catch(const SimpleWeb::system_error &e) {
|
catch(const SimpleWeb::system_error &e) {
|
||||||
cerr << "Client request error: " << e.what() << endl;
|
cerr << "Client request error: " << e.what() << endl;
|
||||||
|
|
|
||||||
|
|
@ -212,7 +212,8 @@ int main() {
|
||||||
server_port.set_value(port);
|
server_port.set_value(port);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
cout << "Server listening on port " << server_port.get_future().get() << endl << endl;
|
cout << "Server listening on port " << server_port.get_future().get() << endl
|
||||||
|
<< endl;
|
||||||
|
|
||||||
// Client examples
|
// Client examples
|
||||||
string json_string = "{\"firstName\": \"John\",\"lastName\": \"Smith\",\"age\": 25}";
|
string json_string = "{\"firstName\": \"John\",\"lastName\": \"Smith\",\"age\": 25}";
|
||||||
|
|
@ -223,11 +224,13 @@ int main() {
|
||||||
try {
|
try {
|
||||||
cout << "Example GET request to http://localhost:8080/match/123" << endl;
|
cout << "Example GET request to http://localhost:8080/match/123" << endl;
|
||||||
auto r1 = client.request("GET", "/match/123");
|
auto r1 = client.request("GET", "/match/123");
|
||||||
cout << "Response content: " << r1->content.rdbuf() << endl << endl; // Alternatively, use the convenience function r1->content.string()
|
cout << "Response content: " << r1->content.rdbuf() << endl // Alternatively, use the convenience function r1->content.string()
|
||||||
|
<< endl;
|
||||||
|
|
||||||
cout << "Example POST request to http://localhost:8080/string" << endl;
|
cout << "Example POST request to http://localhost:8080/string" << endl;
|
||||||
auto r2 = client.request("POST", "/string", json_string);
|
auto r2 = client.request("POST", "/string", json_string);
|
||||||
cout << "Response content: " << r2->content.rdbuf() << endl << endl;
|
cout << "Response content: " << r2->content.rdbuf() << endl
|
||||||
|
<< endl;
|
||||||
}
|
}
|
||||||
catch(const SimpleWeb::system_error &e) {
|
catch(const SimpleWeb::system_error &e) {
|
||||||
cerr << "Client request error: " << e.what() << endl;
|
cerr << "Client request error: " << e.what() << endl;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue