如何调试 Ruby google-api-client 的 HTTP [英] How do I debug HTTP of Ruby google-api-client
问题描述
我正在尝试使用 google-api-client 与 Google Drive 集成.由于发生了很多事情,我希望能够看到网络上发生的事情(http 级别).客户端似乎使用法拉第进行 http 连接.如何从 Faraday 中获取有线转储进行调试?
I'm trying to integrate with Google Drive, using the google-api-client. Since there's a lot of stuff going on, I would like to be able to see what's going over the wire (http level). It seems that the client uses Faraday for http connectivity. How would I get a wiredump out of Faraday for debugging?
推荐答案
Google api 客户端默认使用 Faraday.default_connection
.因此可以操作该对象,只需使用以下代码行即可:
Google api client uses Faraday.default_connection
by default. It is thus possible to manipulate this object, which can be done simply with the following line of code:
Faraday.default_connection.response :logger
我花了一段时间才弄明白.
Took me a while to figure out.
这篇关于如何调试 Ruby google-api-client 的 HTTP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!