共用方式為


http_client::request Method

Asynchronously sends an HTTP request.

_ASYNCRTIMP pplx::task<http_response> request(
   http_request request
);

pplx::task<http_response> request(
   method mtd
);

pplx::task<http_response> request(
   method mtd,
   const utility::string_t &path_query_fragment
);

pplx::task<http_response> request(
   method mtd,
   const utility::string_t &path_query_fragment,
   const json::value &body_data
);

pplx::task<http_response> request(
   method mtd,
   const utility::string_t &path_query_fragment,
   const utility::string_t &body_data,
   utility::string_t content_type = U("text/plain")
);

pplx::task<http_response> request(
   method mtd,
   const utility::string_t &path_query_fragment,
   concurrency::streams::istream body,
   utility::string_t content_type = U("application/octet-stream")
);

pplx::task<http_response> request(
   method mtd,
   const utility::string_t &path_query_fragment,
   concurrency::streams::istream body,
   size_t content_length,
   utility::string_t content_type= U("application/octet-stream")
);

Parameters

  • request
    Request to send.

  • mtd
    HTTP request method.

  • path_query_fragment
    String containing the path, query, and fragment, relative to the http_client's base URI.

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

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

  • body
    An asynchronous stream representing the body data.

  • content_length
    Size of the message body.

Return Value

An asynchronous operation that is completed once a response from the request is received.

Requirements

Header: http_client.h

Namespace: web::http::client

See Also

Reference

http_client Class