Skip to content

Commit

Permalink
Add signeture of Faraday::Connection#options
Browse files Browse the repository at this point in the history
  • Loading branch information
rhiroe committed Sep 24, 2024
1 parent f7684ee commit 259f4fe
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
4 changes: 4 additions & 0 deletions gems/faraday/2.5/_test/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,12 @@
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"))
conn.options(URI("http://example.com/options"))
response = conn.post('/post') do |req|
req.body = "{ query: 'chunky bacon' }"
end
Expand Down
18 changes: 18 additions & 0 deletions gems/faraday/2.5/faraday.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ module Faraday

attr_reader headers: Hash[String, String]

def options: () -> RequestOptions
| ((String | URI)? url, ?untyped params, ?untyped headers) -> Response


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
Expand All @@ -122,6 +126,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?
Expand Down

0 comments on commit 259f4fe

Please sign in to comment.