vibe.d beta banner
get vibe.d

Function HTTPClient.request

Performs a HTTP request.

requester is called first to populate the request with headers and the desired HTTP method and version. After a response has been received it is then passed to the caller which can in turn read the reponse body. Any part of the body that has not been processed will automatically be consumed and dropped.

Note that the requester callback might be invoked multiple times in the event that a request has to be resent due to a connection failure.

Also note that the second form of this method (returning a HTTPClientResponse) is not recommended to use as it may accidentially block a HTTP connection when only part of the response body was read and also requires a heap allocation for the response object. The callback based version on the other hand uses a stack allocation and guarantees that the request has been fully processed once it has returned.


void request(
  scope void delegate(scope HTTPClientRequest) requester,
  scope void delegate(scope HTTPClientResponse) responder

HTTPClientResponse request(
  scope void delegate(HTTPClientRequest) requester

Sönke Ludwig, Jan Krüger


© 2012-2014 RejectedSoftware e.K.


Subject to the terms of the MIT license, as written in the included LICENSE.txt file.