Skip to content

Commit

Permalink
Merge pull request #427 from iloveitaly/logging-docs
Browse files Browse the repository at this point in the history
Logging docs to readme
  • Loading branch information
edgurgel authored Nov 1, 2020
2 parents 40580cd + 4c387d9 commit 8d9c2f3
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 @@ -68,6 +68,7 @@ case HTTPoison.get(url) do
IO.inspect reason
end
```

### Options

There are a number of supported options(*not to be confused with the HTTP options method*), documented [here](https://hexdocs.pm/httpoison/HTTPoison.html#request/5), that can be added to your request. The example below shows the use of the `:ssl` and `:recv_timeout` options for a post request to an api that requires a bearer token. The `:ssl` option allows you to set options accepted by the [Erlang SSL module](http://erlang.org/doc/man/ssl.html), and `:recv_timeout` sets a timeout on receiving a response, the default is 5000ms.
Expand Down Expand Up @@ -301,6 +302,16 @@ iex(2)> HTTPoison.Handlers.Multipart.decode_body(response)

For more complex queries regarding multipart response parsing, you should follow the [hackney docs for the `hackney_multipart` API](https://github.com/benoitc/hackney/blob/master/doc/hackney_multipart.md).

### Logging

If you're running on top of hackney (which you probably are) there's a handy way to get detailed request logging:

```
:hackney_trace.enable(:max, :io)
```

Just throw this in your code before your HTTPoison call and you'll get low-level log output.

## License

Copyright © 2013-2019 Eduardo Gurgel <[email protected]>
Expand Down

0 comments on commit 8d9c2f3

Please sign in to comment.