peppermint v0.2.0 Peppermint.Connection View Source
Reusable process to handle a connection. Allowing simulatious requests (over HTTP/2).
Example:
{:ok, conn} = Peppermint.Connection.open("http://httpbin.org")
{:ok, response} = Peppermint.Connection.request(conn, :get, "/get?foo=bar")
{:ok, response} = Peppermint.Connection.request(conn, :post, "/post", params: %{foo: "bar"})
:ok = Peppermint.Connection.close(conn)
Link to this section Summary
Functions
Returns a specification to start this module under a supervisor.
Close the connection
Open a connection to a host
Execute a request and wait for the response
Link to this section Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
Specs
close(pid()) :: :ok
Close the connection
Specs
Open a connection to a host
Specs
request(pid(), atom(), String.t(), keyword()) :: {:ok, Peppermint.Reponse.t()} | {:error, Mint.Types.error()} | {:error, :timeout}
Execute a request and wait for the response