Skip to content

Commit

Permalink
Update README.md with instructions on how to read cookies
Browse files Browse the repository at this point in the history
  • Loading branch information
lilactown committed Jan 26, 2017
1 parent a3da6a9 commit a57ab97
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,17 @@ iex> HTTPoison.get!("http://httparrot.herokuapp.com/cookies", %{}, hackney: [coo
status_code: 200}
```

You can also receive cookies from the server by reading the `"set-cookie"` headers in the response:

```elixir
iex(1)> response = HTTPoison.get!("http://httparrot.herokuapp.com/cookies/set?foo=1")
iex(2)> cookies = Enum.filter(response.headers, fn
...(2)> {"Set-Cookie", _} -> true
...(2)> _ -> false
...(2)> end)
[{"Set-Cookie", "foo=1; Version=1; Path=/"}]
```

You can see more usage examples in the test files (located in the
[`test/`](test)) directory.

Expand Down

0 comments on commit a57ab97

Please sign in to comment.