net-http2 icon indicating copy to clipboard operation
net-http2 copied to clipboard

Consider add a block version of Client.new?

Open jrochkind opened this issue 9 years ago • 1 comments

It would self-close by calling #close in an ensure block (ensure is important!) after the block param is finished.

NetHttp2::Client.new("http://106.186.112.116") do
     client.get something
     client.post something
end

Or doc that if it already exists. :)

jrochkind avatar Apr 29 '16 13:04 jrochkind

This issue was opened before NetHttp2 had async calls too.

If a block generates a client, you would expect to be able to use all the features of a client, and I don't really see how you wold use this block to perform async calls too (since something needs to block to wait for async replies).

What is your opinion on this?

ostinelli avatar May 23 '16 08:05 ostinelli