From dbafeb5ceee84b50d60e1a938248fb60a9b80960 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cxxq250=E2=80=9D?= <“xxq250@qq.com”> Date: Fri, 21 Oct 2022 17:02:18 +0800 Subject: [PATCH] =?UTF-8?q?fixed=20=E7=AC=AC=E4=B8=89=E6=96=B9Gitlink?= =?UTF-8?q?=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/libs/gitlink_oauth/service.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/libs/gitlink_oauth/service.rb b/app/libs/gitlink_oauth/service.rb index 8afc913c..25b5803c 100644 --- a/app/libs/gitlink_oauth/service.rb +++ b/app/libs/gitlink_oauth/service.rb @@ -7,7 +7,15 @@ module GitlinkOauth::Service begin Rails.logger.info("[GitlinkOauth] [#{method.to_s.upcase}] #{url} || #{params}") - client = Faraday.new(url: GitlinkOauth.base_url) + # client = Faraday.new(url: GitlinkOauth.base_url) + client = Faraday.new(url: GitlinkOauth.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 response = client.public_send(method, url, params) result = JSON.parse(response.body)