Sha256: 02d4ec3c0c9531eaa4d575bab8e22e02d36a94a4a384e49f7d98e44ada2e7fba
Contents?: true
Size: 538 Bytes
Versions: 6
Compression:
Stored size: 538 Bytes
Contents
module Rack::App::InstanceMethods::Payload def payload request.env[Rack::App::Constants::ENV::PAYLOAD_GETTER].call end def payload_stream(&block) return nil unless @request.body.respond_to?(:gets) while chunk = @request.body.gets block.call(chunk) end @request.body.rewind nil end def payload_to_file(file_path, file_mod='w') return nil unless @request.body.respond_to?(:gets) File.open(file_path, file_mod) do |file| payload_stream{ |chunk| file.print(chunk) } end end end
Version data entries
6 entries across 6 versions & 1 rubygems