fixed ci4s oauth2接入 log
This commit is contained in:
parent
04da22ed64
commit
45f597ab47
|
@ -31,7 +31,16 @@ module Ci4s::Service
|
|||
begin
|
||||
Rails.logger.info("[Ci4sOauth] [#{method.to_s.upcase}] #{url} || #{params}")
|
||||
|
||||
client = Faraday.new(url: base_url)
|
||||
client ||= begin
|
||||
Faraday.new(url: base_url) do |req|
|
||||
req.request :url_encoded
|
||||
req.headers['Content-Type'] = 'application/json'
|
||||
req.response :logger # 显示日志
|
||||
req.adapter Faraday.default_adapter
|
||||
req.authorization :Bearer, params[:access_token]
|
||||
req.headers['Authorization']
|
||||
end
|
||||
end
|
||||
response = client.public_send(method, url, params)
|
||||
result = JSON.parse(response.body)
|
||||
|
||||
|
|
Loading…
Reference in New Issue