Answers for "transfer encoding chunked ruby"

0

transfer encoding chunked ruby

require 'net/http'

streamURL = 'http://localhost/sample-stream.php'

uri = URI.parse(streamURL)

Net::HTTP.start(uri.host, uri.port) do |http|
  request = Net::HTTP::Get.new uri.request_uri

  http.request request do |response|
    response.read_body do |chunk|
       #We get the data here chunk-by-chunk
       puts chunk
    end
  end
end
Posted by: Guest on March-03-2021

Browse Popular Code Answers by Language