http_request::reply 方法
對這個 HTTP 要求的非同步回應。
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;
參數
response
傳送的回應。status
回應狀態碼。body_data
字串,包含用於回應主題的文字。content_type
保存訊息主體之 MIME 類型的字串。body
表示主體資料的非同步資料流。content_length
要在主體中傳送之資料的大小。
傳回值
一旦傳送回應即已完成的非同步作業。
備註
根據我們決定是否要複製主體資料的內部演算法,回應可能以同步或非同步方式傳送。 無論使用哪種方式,在主體資料終結或超出範圍之前,這個函式的呼叫端不需要封鎖等候要傳送到的回應。
需求
**標頭:**http_msg.h
**命名空間:**web::http