123456module juptune.http.client;
Result request(
HttpRequest request,
HttpResponse response
);
Sends a request to the server and returns the response.
This is the 'Simple' way to send a request, and is the easiest to use.
This function will automatically add the Hostheader if it is not already present.
If the request has a body and does not have a Content-Lengthor Transfer-Encodingheader, then this function will automatically add a Transfer-Encoding: chunkedheader.
If the request does not have a Hostheader, then this function will automatically add one using the hostprovided by the relevant connect function that was used.
The client will gracefully close the connection in normal circumstances such as the Connection: closeheader being present.
The state of the responseparameter is undefined if this function returns an error.
This function will automatically close the connection if an error occurs.
The client must be connected.
Anything that TcpSocket.sendor TcpSocket.receivecan throw.
If using HTTP1, anything that Http1Writeror Http1Readercan throw (`Http1Error`).
A Resultindicating whether the request was successful or not.