Share via


http_request Class

Represents an HTTP request.

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_request;

Members

Public Constructors

Name

Description

http_request::http_request Constructor

Overloaded. Constructs a new HTTP request with the given request method.

http_request::~http_request Destructor

Destructor frees any held resources.

Public Methods

Name

Description

http_request::body Method

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

http_request::content_ready Method

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

http_request::extract_json Method

Extracts the body of the request 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_request::extract_string Method

Extract the body of the request 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_request::extract_vector Method

Extract the body of the response message into a vector of bytes. Extracting a vector can be done on

http_request::get_response Method

Gets a task representing the response that will eventually be sent.

http_request::headers Method

Overloaded. Gets a reference to the headers of the response message.

http_request::method Method

Get the method (GET/PUT/POST/DELETE) of the request message.

http_request::relative_uri Method

Gets a reference the URI path, query, and fragment part of this request message. This will be appended to the base URI specified at construction of the http_client.

http_request::reply Method

Overloaded. Asynchronously responses to this HTTP request.

http_request::request_uri Method

Get the underling URI of the request message.

http_request::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_request::set_method Method

Get the method (GET/PUT/POST/DELETE) of the request message.

http_request::set_request_uri Method

Set the underling URI of the request message.

http_request::set_response_stream Method

Defines a stream that will be relied on to hold the body of the HTTP response message that results from the request.

http_request::to_string Method

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

Public Operators

Name

Description

http_request::operator= Operator

Assignment operator.

Requirements

Header: http_msg.h

Namespace: web::http

See Also

Reference

web::http Namespace