Actions
Feature #9556
openAdd HTTP#get block functionality to HTTP.get
Status:
Open
Assignee:
-
Target version:
-
Description
This is kind of an alternative to #9527.
HTTP#get can be passed a block. The shortcut method, HTTP.get, however, cannot. This patch adds such functionality.
This allows someone to be able to write the response of a GET, in fragments, without dealing directly with Net::HTTPResponse, like the request in #9527:
File.open('result.zip', 'wb') {|f|
Net::HTTP.get('www.example.com', '/file.zip') do |chunk|
f.write chunk
end
}
This patch includes that example as documentation, and a test. It is attached, and available at: https://github.com/srawlins/ruby/compare/add-block-to-http-get
Files
No data to display
Actions
Like0