21
20

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Ruby の HTTPClient でよく忘れる設定

Posted at

Ruby の HTTPClient を使うときに、毎回調べてるやつをまとめとく。

タイムアウトを延したい

HTTPClient のデフォルトのタイムアウトは 60 秒に設定されている。
これを延したい場合、HTTPClient#connect_timeout, HTTPClient#send_timeout, HTTPClient#receive_timeout をそれぞれ設定する。

client.connect_timeout = 100
client.send_timeout    = 100
client.receive_timeout = 100

リクエスト、レスポンスの内容を表示したい

HTTPClient#debug_dev= に出力先を指定する。

client = HTTPClient.new
client.debug_dev = STDOUT
21
20
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
21
20

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?