Skip to content

Commit

Permalink
Merge pull request #252 from kajisha/add-ssl_options-document
Browse files Browse the repository at this point in the history
Add an example for Hackney's ssl_options
  • Loading branch information
edgurgel authored May 20, 2017
2 parents cdbad8e + 236b805 commit 531f09a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 531f09a

Please sign in to comment.