Sha256: 91a5be4cc6daf9636924843b07cdf0e4b968cc51e03655a824ebf73fd8364a3d

Contents?: true

Size: 704 Bytes

Versions: 1

Compression:

Stored size: 704 Bytes

Contents

module M2R
  # Logic for typical Mongrel2 request with no fancy features such as
  # async upload
  #
  # @private
  module Base
    MONGREL2_BASE_HEADERS = %w(pattern method path query url_scheme).map(&:freeze).freeze

    # @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

    protected

    def mongrel_headers
      MONGREL2_BASE_HEADERS
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
m2r-1.0.0 lib/m2r/request/base.rb