Create a new HTTP Client for the provided host/port.
Create a new HTTP Client for the provided host/port.
the host to use to setup the TCP connections.
the port to use to setup the TCP connections.
either http or https.
if provided the custom SSL configuration to use for this client.
the client options such as the number of IO thread used.
the maximum number of TCP connections to maintain with the remote server.
the maximum amount of time requests will wait for a connection. Default to 5 seconds.
the ExecutionContext to use to run user code.
an HTTP client instance.
Run the provided request with a temporary client, and apply the thunk function to the response.
Run the provided request with a temporary client, and apply the thunk function to the response.
the request to run. It must include a proper Host
header.
if true follow the intermediate HTTP redirects. Default to true.
maximum amount of time allowed to retrieve the response and extract the return value.
the client options to use for the temporary client.
a function that eventually receive the response and transform it to a value of type A
.
eventually a value of type A
.
Build HTTP clients.
Once created an HTTP client maintains several TCP connections to the remote server, and can be reused to run several requests. It is better to create a dedicated client this way if you plan to send many requests to the same server.
However there are some situations where you have a single request to run, or you have a batch of requests to send over an unknown set of servers. In this case you can use the run operation that automatically create a temporary HTTP client to run the request and trash it after the exchange completion.
Note that in this case, for each request, a new client (including the whole IO infrastructure) will to be created, and a new TCP connection will be opened to the server.