Share via


http_response Class

Represents an HTTP response.

Warning

This topic contains information for the C++ REST SDK 1.0 (codename "Casablanca"). If you are using a later version from the Codeplex Casablanca web page, then use the local documentation at http://casablanca.codeplex.com/documentation.

class http_response;

Members

Public Constructors

Name

Description

http_response::http_response Constructor

Overloaded. Constructs a response with an empty status code, no headers, and no body.

Public Methods

Name

Description

http_response::body Method

Produces a stream which the caller may use to retrieve data from an incoming request.

http_response::content_ready Method

Signals the user (client) when all the data for this response message has been received.

http_response::error_code Method

Gets the error code of the response. This is used for errors other than HTTP status codes.

http_response::extract_json Method

Extracts the body of the response message into a json value, checking that the content type is application\json. A body can only be extracted once because in some cases an optimization is made where the data is 'moved' out.

http_response::extract_string Method

Extracts the body of the response message as a string value, checking that the content type is a MIME text type. A body can only be extracted once because in some cases an optimization is made where the data is 'moved' out.

http_response::extract_vector Method

Extracts the body of the response message into a vector of bytes.

http_response::headers Method

Overloaded. Gets the headers of the response message.

http_response::reason_phrase Method

Gets the reason phrase of the response message. If no reason phrase is set it will default to the standard one corresponding to the status code.

http_response::set_body Method

Overloaded. Sets the body of the message to a textual string and set the "Content-Type" header. Assumes the character encoding of the string is the OS's default code page and will perform appropriate conversions to UTF-8.

http_response::set_error_code Method

Sets the error code of the response. This is used for errors other than HTTP status codes.

http_response::set_reason_phrase Method

Sets the reason phrase of the response message. If no reason phrase is set it will default to the standard one corresponding to the status code.

http_response::set_status_code Method

Sets the status code of the response message.

http_response::status_code Method

Gets the status code of the response message.

http_response::to_string Method

Generates a string representation of the message, including the body when possible.

Public Operators

Name

Description

http_response::operator= Operator

Assignment operator.

Requirements

Header: http_msg.h

Namespace: web::http

See Also

Reference

web::http Namespace