http icon indicating copy to clipboard operation
http copied to clipboard

API for connection auto-close

Open ixti opened this issue 8 years ago • 3 comments

Sometimes I need to make a GET request, and terminate connection before receiving body, so I end up with having something like:

def get_cookies(...)
  http = HTTP.headers(...)
  http.get(...).cookies
ensure
  http.close
end

Sometimes I want to guarantee that connection is closed in case of error while I was streaming response... So, probably it worth to provide API like:

http = HTTP.headers(...)
http.get(...) { |res| ... }

ixti avatar Dec 12 '15 14:12 ixti

:+1:

sferik avatar Dec 12 '15 15:12 sferik

SGs

Sent from my iPhone

On Dec 12, 2015, at 07:12, Erik Michaels-Ober [email protected] wrote:

— Reply to this email directly or view it on GitHub.

zanker avatar Dec 12 '15 15:12 zanker

:+1: :+1: :+1:

tarcieri avatar Dec 13 '15 01:12 tarcieri