Sha256: f71d9eda36859fbbb194ee05e29edf0407fb7b9e822e4d241d3ce707c74fe5e0

Contents?: true

Size: 520 Bytes

Versions: 6

Compression:

Stored size: 520 Bytes

Contents

# frozen_string_literal: true

require 'rubygems'
require 'rack'

module MyApp
  module Test
    class Server
      def call(env)
        @root = "#{__dir__}/../docs/"
        path = Rack::Utils.unescape(env['PATH_INFO'])
        path += 'index.html' if path == '/'
        file = @root + path.to_s

        if File.exist?(file)
          [200, { 'Content-Type' => 'text/html' }, File.read(file)]
        else
          [404, { 'Content-Type' => 'text/plain' }, 'file not found']
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
ruby_tika_app_lambda-1.25.4 spec/support/test_server.rb
ruby_tika_app_lambda-1.25.3 spec/support/test_server.rb
ruby_tika_app_lambda-1.25.2 spec/support/test_server.rb
ruby_tika_app_lambda-1.25.1 spec/support/test_server.rb
ruby_tika_app_lambda-1.25.0 spec/support/test_server.rb
ruby_tika_app-1.9.0 spec/support/test_server.rb