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