mirror of
https://github.com/discourse/discourse.git
synced 2024-12-21 15:43:43 +08:00
30 lines
516 B
Ruby
30 lines
516 B
Ruby
|
# frozen_string_literal: true
|
||
|
|
||
|
class Auth::OauthFaradayFormatter < Faraday::Logging::Formatter
|
||
|
def request(env)
|
||
|
warn <<~LOG
|
||
|
OAuth Debugging: request #{env.method.upcase} #{env.url}
|
||
|
|
||
|
Headers:
|
||
|
#{env.request_headers}
|
||
|
|
||
|
Body:
|
||
|
#{env[:body]}
|
||
|
LOG
|
||
|
end
|
||
|
|
||
|
def response(env)
|
||
|
warn <<~LOG
|
||
|
OAuth Debugging: response status #{env.status}
|
||
|
|
||
|
From #{env.method.upcase} #{env.url}
|
||
|
|
||
|
Headers:
|
||
|
#{env.response_headers}
|
||
|
|
||
|
Body:
|
||
|
#{env[:body]}
|
||
|
LOG
|
||
|
end
|
||
|
end
|