Closed
Description
Hi,
I would like stream attachments through grape. By reading the doc, I can do this :
class AttachmentStream
attr_reader :response
def initialize(response)
@response = response
end
def each
yield response.read_body
end
end
source = URI(@attachment_context.url)
Net::HTTP.start(source.host, source.port, use_ssl: true) do |http|
req = Net::HTTP::Get.new source
http.request(req) do |res|
stream AttachmentStream.new(res)
end
end
Unfortunately, there is a warning that says :
'[DEPRECATION] Argument as FileStreamer-like object is deprecated. Use path to file instead.'
Is is still relevant ?
Thanks