http_request class and API methods

Sep 15, 2014 at 12:20 PM

When using API methods, one usually use a http_request with one of the API methods such as GET, POST etc.
I would like to know why the lines below works and what happens when no method name is passed to the request?

web::http::http_request request;
web::http::http_response response = client.request(request).get();

I know that the status code is OK:
cout << "response.status_code() << endl;

The http_request class has one constructor with no method as parameter. The summary however tells that the method need to be given:
/// <summary>
/// Constructs a new HTTP request with the given request method.
/// </summary>
/// <param name="method">Request method.</param>
    : _m_impl(std::make_shared<http::details::_http_request>()) {}
Best regards
Sep 15, 2014 at 9:00 PM
Hi RezRaz,

Good catch on the documentation. Looking at the code, I suspect the default doesn't have a method set and you'll need to set it through some other means. The documentation needs to be updated to reflect this -- I've added an issue to track it.