我正在尝试向SpingoAPI发出请求。我使用 Curl 提出了成功的请求,但我正在尝试使用 Faraday gem。
成功的 curl 请求如下所示:
curl -v --url "calendarapi.spingo.com/v1/events?sections=42336" --header 'Authorization: SpingoAPI token="my-api-key"'
Run Code Online (Sandbox Code Playgroud)
最初我尝试使用默认适配器net-http。然后我切换到Typheous适配器,因为在 Authorization 标头中将net-http我的SpingoAPI方案大写。这使它读取 Spingoapi。现在我的请求是这样的:
def make_request
conn = Faraday.new(base_url) do |f|
f.params['sections'] = '42336'
f.adapter :typhoeus
f.use Faraday::Response::Logger
end
conn.authorization(:SpingoAPI, token: api_key)
conn.get
end
Run Code Online (Sandbox Code Playgroud)
切换到Typheous允许返回(我没有得到任何返回net-http) 所以我的响应看起来像这样。
ETHON: performed EASY effective_url=url
sections=42336 response_code=200 return_code=ok total_time=0.844381
I, [2015-08-05T11:16:06.575611 #22692] INFO -- : get http://www.calendarapi.spingo.com/v1/events?sections=42336
D, [2015-08-05T11:16:06.575842 #22692] DEBUG -- request: User-Agent: "Faraday …Run Code Online (Sandbox Code Playgroud) 我正在将现有应用程序从 Sentry-raven 迁移到 Sentry-ruby。然而,迁移指南中似乎缺少一部分。
我该如何处理#sanitize_fields?
旧的配置如下所示:
Raven.configure do |config|
config.sanitize_fields = filter_parameters
end
Run Code Online (Sandbox Code Playgroud)
但是,#sanitize_fields 已被删除,而且我没有看到该功能被替换的任何地方。
我们用它来确保密码和确认信息不会发送到 Sentry(糟糕的一天),所以我需要在使用sentry-ruby 时做一些事情。
任何帮助将不胜感激。