Sha256: 040a91afd82948a695d54fb700427064cba3c6a1677a9bae8b7a5c181a947c30

Contents?: true

Size: 438 Bytes

Versions: 3

Compression:

Stored size: 438 Bytes

Contents

module Rail
  class Request
    attr_reader :env

    def initialize(env)
      @env = rewrite(env)
    end

    def path
      env['PATH_INFO']
    end

    def host
      env['HTTP_HOST']
    end

    private

    def rewrite(env)
      path = env['PATH_INFO']
      path = '/index.html' if [nil, '', '/'].include?(path)
      path = "#{path}.html" if File.extname(path).empty?
      env['PATH_INFO'] = path
      env
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rail-0.1.1 lib/rail/request.rb
rail-0.1.0 lib/rail/request.rb
rail-0.0.8 lib/rail/request.rb