Interpreting the Reply
An RWHttpReply object has several member functions that access the information returned from the HTTP server. These functions can retrieve:
*Headers
*Status code and status message
*Version of the HTTP response
*Body of the message
Example 8 shows how to check the status of the reply, and how to retrieve the body of the message. It checks the status of the reply to ensure that the request is successful.
Example 8 – Checking the status and retrieving the body of the message
if(reply.is2XX()) {
cout << reply.getBody() << endl;
}
NOTE: A status code in the 200 range usually indicates success. For more information about status codes, see RFC 2616, which defines the HTTP protocol.
If the reply is successful, the body of the message is retrieved as an RWCString, and the message body is streamed to stdout.