Sha256: c1643c852f8dea8c9d6f405e1fafa6330527b464aff6f03d52c4f6e00b8a4548

Contents?: true

Size: 537 Bytes

Versions: 5

Compression:

Stored size: 537 Bytes

Contents

module M2R
  # Logic for typical Mongrel2 request with no fancy features such as
  # async upload
  #
  # @private
  module Base
    # @return [StringIO] Request body encapsulated in IO compatible object
    # @api public
    def body_io
      @body_io ||= begin
        b = StringIO.new(body)
        b.set_encoding(Encoding::BINARY) if b.respond_to?(:set_encoding)
        b
      end
    end

    # @return [nil] Free external resources such as files or sockets
    # @api public
    def free!
      body_io.close
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
m2r-2.1.0 lib/m2r/request/base.rb
m2r-2.1.0.pre lib/m2r/request/base.rb
m2r-2.0.2 lib/m2r/request/base.rb
m2r-2.0.1 lib/m2r/request/base.rb
m2r-2.0.0 lib/m2r/request/base.rb