Updated post json example in https_examples.cpp as well
This commit is contained in:
parent
b44fdc8183
commit
1a2fe59fa9
1 changed files with 5 additions and 2 deletions
|
|
@ -57,7 +57,10 @@ int main() {
|
||||||
|
|
||||||
string name=pt.get<string>("firstName")+" "+pt.get<string>("lastName");
|
string name=pt.get<string>("firstName")+" "+pt.get<string>("lastName");
|
||||||
|
|
||||||
*response << "HTTP/1.1 200 OK\r\nContent-Length: " << name.length() << "\r\n\r\n" << name;
|
*response << "HTTP/1.1 200 OK\r\n"
|
||||||
|
<< "Content-Type: application/json\r\n"
|
||||||
|
<< "Content-Length: " << name.length() << "\r\n\r\n"
|
||||||
|
<< name;
|
||||||
}
|
}
|
||||||
catch(exception& e) {
|
catch(exception& e) {
|
||||||
*response << "HTTP/1.1 400 Bad Request\r\nContent-Length: " << strlen(e.what()) << "\r\n\r\n" << e.what();
|
*response << "HTTP/1.1 400 Bad Request\r\nContent-Length: " << strlen(e.what()) << "\r\n\r\n" << e.what();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue