Sha256: e0d20227de20da61a68f7e0e7432497538f45c275e2328eb556378480082488c

Contents?: true

Size: 696 Bytes

Versions: 6

Compression:

Stored size: 696 Bytes

Contents

module Authograph::Adapters
  class Rack < Base
    def initialize(_request)
      @request = _request
    end

    def get_header(_header)
      @request.env[normalize_header(_header)]
    end

    def set_header(_header, _value)
      @request.env[normalize_header(_header)] = _value
    end

    def method
      @request.request_method.upcase
    end

    def path
      @request.fullpath
    end

    def content_type
      @request.content_type
    end

    def body
      return '' unless @request.body
      data = @request.body.read
      @request.body.rewind
      data
    end

    private

    def normalize_header(_header)
      'HTTP_' + _header.underscore.upcase
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
authograph-1.0.5 lib/authograph/adapters/rack.rb
authograph-1.0.4 lib/authograph/adapters/rack.rb
authograph-1.0.3 lib/authograph/adapters/rack.rb
authograph-1.0.2 lib/authograph/adapters/rack.rb
authograph-1.0.1 lib/authograph/adapters/rack.rb
authograph-1.0.0 lib/authograph/adapters/rack.rb