Share via


http_request::reply Method

Asynchronously responses to this HTTP request.

pplx::task<void> reply(
   http_response response
) const;

pplx::task<void> reply(
   http::status_code status
) const;

pplx::task<void> reply(
   http::status_code status,
   const json::value &body_data
) const;

pplx::task<void> reply(
   http::status_code status,
   utility::string_t body_data,
   utility::string_t content_type = U("text/plain")
) const;

pplx::task<void> reply(
   status_code status,
   concurrency::streams::istream body,
   utility::string_t content_type = U("application/octet-stream")
) const;

pplx::task<void> reply(
   status_code status,
   concurrency::streams::istream body,
   size_t content_length,
   utility::string_t content_type= U("application/octet-stream")
) const;

Parameters

  • response
    Response to send.

  • status
    Response status code.

  • body_data
    String containing the text to use in the response body.

  • content_type
    A string holding the MIME type of the message body.

  • body
    An asynchronous stream representing the body data.

  • content_length
    The size of the data to be sent in the body..

Return Value

An asynchronous operation that is completed once response is sent.

Remarks

The response may be sent either synchronously or asychronously depending on an internal algorithm on whether we decide or not to copy the body data. Either way callers of this function do NOT need to block waiting for the response to be sent to before the body data is destroyed or goes out of scope.

Requirements

Header: http_msg.h

Namespace: web::http

See Also

Reference

http_request Class