0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-06 13:08:40 +08:00
discourse/lib/auth/oauth_faraday_formatter.rb
Natalie Tay 6bb8ac54cb
DEV: Include a basic oauth faraday formatter in core for usage in managed authenticators (#28758)
We currently have some occurrences of ____FaradayFormatter for OAuth logs. This commit creates a generic formatter so that any new authenticators can use it.
2024-09-05 22:29:29 +08:00

29 lines
516 B
Ruby
Vendored

# 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