From 44518965d67300aef592e71f1526ebee91d997da Mon Sep 17 00:00:00 2001 From: rhiroe Date: Tue, 24 Sep 2024 12:09:39 +0900 Subject: [PATCH] Add signeture of Faraday::Connection#options --- gems/faraday/2.5/_test/test.rb | 3 +++ gems/faraday/2.5/faraday.rbs | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/gems/faraday/2.5/_test/test.rb b/gems/faraday/2.5/_test/test.rb index 2ae9c66d..8acad21c 100644 --- a/gems/faraday/2.5/_test/test.rb +++ b/gems/faraday/2.5/_test/test.rb @@ -51,6 +51,9 @@ faraday.request :url_encoded faraday.response :logger, bodies: true faraday.adapter :net_http + faraday.options.open_timeout = 5 + faraday.options.read_timeout = 10 + faraday.options.write_timeout = 5 end conn.post(URI("http://example.com/post")) response = conn.post('/post') do |req| diff --git a/gems/faraday/2.5/faraday.rbs b/gems/faraday/2.5/faraday.rbs index 6fd30f68..efbe84f8 100644 --- a/gems/faraday/2.5/faraday.rbs +++ b/gems/faraday/2.5/faraday.rbs @@ -112,6 +112,8 @@ module Faraday attr_reader headers: Hash[String, String] + def options: () -> Faraday::RequestOptions + def get: (?String | URI url, ?untyped params, ?untyped headers) ?{ (Faraday::Request) -> void } -> Faraday::Response def head: (?String | URI url, ?untyped params, ?untyped headers) ?{ (Faraday::Request) -> void } -> Faraday::Response def delete: (?String | URI url, ?untyped params, ?untyped headers) ?{ (Faraday::Request) -> void } -> Faraday::Response @@ -122,6 +124,20 @@ module Faraday def patch: (?String | URI url, ?untyped body, ?untyped headers) ?{ (Faraday::Request) -> void } -> Faraday::Response end + class RequestOptions + attr_accessor params_encoder: untyped + attr_accessor proxy: untyped + attr_accessor bind: untyped + attr_accessor timeout: untyped + attr_accessor open_timeout: untyped + attr_accessor read_timeout: untyped + attr_accessor write_timeout: untyped + attr_accessor boundary: untyped + attr_accessor oauth: untyped + attr_accessor context: untyped + attr_accessor on_data: untyped + end + class Error < StandardError attr_reader response: Hash[Symbol, untyped]? attr_reader wrapped_exception: Exception?