api_struct icon indicating copy to clipboard operation
api_struct copied to clipboard

Timeout

Open jfanals opened this issue 4 years ago • 1 comments

Is there a way of passing a timeout option (open_timeout, read_timeout, write_timeout) to the http methods?

jfanals avatar Mar 31 '20 19:03 jfanals

This wasn't easy so I will share it in case anyone else is struggling with it. You can pass the timeout_options like this if you want a timeout per operation (there is a global timeout as well but I haven't used it):

get('test', headers: request_headers, timeout_class: HTTP::Timeout::PerOperation, timeout_options: {read_timeout: TIMEOUT_VALUE, write_timeout: TIMEOUT_VALUE})

You can also configure connect_timeout

ozkrpp avatar Sep 09 '22 22:09 ozkrpp