From 236b805c70223c3382d7529905e5d15beee214d9 Mon Sep 17 00:00:00 2001 From: kajisha Date: Fri, 19 May 2017 20:50:02 +0900 Subject: [PATCH] Add an example for Hackney's ssl_options --- README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e6b35c1..45fb7fe 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,14 @@ options = [ssl: [{:versions, [:'tlsv1.2']}], recv_timeout: 500] {:ok, response} = HTTPoison.get(url, headers, options) ``` +And the example below shows the use of the `:ssl` options for a post request to an api that requires a client certification. + +```elixir +url = "https://example.org/api/endpoint_that_needs_client_cert" +options = [ssl: [certfile: "certs/client.crt"]] +{:ok, response} = HTTPoison.post(url, [], options) +``` + ### Wrapping `HTTPoison.Base` You can also use the `HTTPoison.Base` module in your modules in order to make @@ -181,7 +189,7 @@ You can also receive cookies from the server by reading the `"set-cookie"` heade ```elixir iex(1)> response = HTTPoison.get!("http://httparrot.herokuapp.com/cookies/set?foo=1") -iex(2)> cookies = Enum.filter(response.headers, fn +iex(2)> cookies = Enum.filter(response.headers, fn ...(2)> {"Set-Cookie", _} -> true ...(2)> _ -> false ...(2)> end)