Class: Proc::Http::Client
- Inherits:
-
Object
- Object
- Proc::Http::Client
- Includes:
- Is::Async
- Defined in:
- lib/proc/http/client.rb
Instance Method Summary collapse
Instance Method Details
#call(method, uri, params: {}, headers: {}, body: nil) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/proc/http/client.rb', line 16 def call(method, uri, params: {}, headers: {}, body: nil) internet = Async::HTTP::Internet.new request = Request.new(method: method, uri: uri, params: params, headers: headers, body: body) await { begin response = make_request(internet, request) yield response ensure response&.close internet&.close end } end |