9.0.0.5
Creates a new session, which can house multiple requests with a common
configuration.
A session has a pool of connections, and the pool is configured through
the pool_config structor argument, which is a
PoolConfig.
The context argument configures security properties for HTTP
requests. By default, connections are secure using the operating
system’s default certificate store.
A session is Closeable, where closing a session via
the Session.close method closes all of its associated connections and
responses.
|
method (session :: Session).request( | uri :: Bytes || String || url.URL || LiteralURL, | ~method: method :: Method = #'get, | ~close: close :: Any.to_boolean = #false, | ~stream: stream :: Any.to_boolean = #false, | ~headers: headers :: Headers = {}, | ~params: params :: List.of(url.KeyValue) = [], | ~auth: auth :: maybe(auth.Function) = #false, | ~data: data :: maybe(Bytes || String || Port.Input || payload.Function) = #false, | ~timeouts: timeouts :: Timeouts = Timeouts(), | ~max_attempts: max_attempts :: PosInt = 3, | ~max_redirects: max_redirects :: PosInt = 16, | ~user_agent: user_agent :: Bytes || String = current_user_agent() | ) :: Response |
|
Sends an HTTP request. By default, a
GET request is sent, but the
method argument selects the type of request. The functions
get,
post,
delete,
head,
options,
patch, and
put are the same as
calling
Session.request with the corresponding request type (on a
Session object that is given as a
~session
argument, defaulting to a fresh session).
The default session used by
get,
post, etc.