Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log the request in debug mode #125

Merged
merged 2 commits into from
Dec 20, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 13 additions & 1 deletion lib/oauth2/request.ex
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
defmodule OAuth2.Request do
@moduledoc false


require Logger
import OAuth2.Util

alias OAuth2.{Client, Error, Response, Serializer}
Expand All @@ -20,6 +21,17 @@ defmodule OAuth2.Request do
headers = process_request_headers(headers, content_type)
req_opts = Keyword.merge(client.request_opts, opts)

if Application.get_env(:oauth2, :debug) do
Logger.debug("""
OAuth2 Provider Request
url: #{inspect url}
method: #{inspect method}
headers: #{inspect headers}
body: #{inspect body}
req_opts: #{inspect req_opts}
""")
end

case :hackney.request(method, url, headers, body, req_opts) do
{:ok, ref} when is_reference(ref) ->
{:ok, ref}
Expand Down