如何调试Ruby的google-api-client的HTTP [英] How do I debug HTTP of Ruby google-api-client

查看:128
本文介绍了如何调试Ruby的google-api-client的HTTP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用google-api-client与Google云端硬盘进行整合。由于有很多事情正在进行,我希望能够看到线路上发生了什么(http级别)。看起来客户端使用Faraday进行http连接。如何从法拉第获得一个用于调试的线路?

默认。因此可以操作这个对象,这可以简单地用下面这行代码完成:

  Faraday.default_connection.response :记录者

花了我一段时间才弄清楚。


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 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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆