icyleaf/halite

Bug when using `timeout()` inside `Halite::Client.new do`

oprypin opened this issue · 0 comments

I think this line has a bug because it looks different from other lines around it:

def timeout(timeout : Int32? | Float64? | Time::Span?)
timeout ? timeout(timeout, timeout, timeout) : branch
end

I have this code

c = Halite::Client.new do
  endpoint("https://example.com/")
  timeout(1.seconds)
  logging(skip_request_body: true, skip_response_body: true)
end

I get this error

 92 | timeout(1.seconds)
      ^------
Error: instantiating 'timeout(Time::Span)'


In lib/halite/src/halite/chainable.cr:224:54

 224 | timeout ? timeout(timeout, timeout, timeout) : branch
                                                      ^-----
Error: instantiating 'branch()'


In lib/halite/src/halite/client.cr:275:23

 275 | oneshot_options.merge!(options)
                       ^-----
Error: no overload matches 'Halite::Options#merge!' with type Nil

Overloads are:
 - Halite::Options#merge!(other : Halite::Options)