Sha256: fc49c223a3c6879b6a4dc1dcef4eca98e8af8e6a66ce53d39e49f379015a8667

Contents?: true

Size: 450 Bytes

Versions: 4

Compression:

Stored size: 450 Bytes

Contents

module LocalPac
  class FileServer < Sinatra::Base
    not_found do
      "Sorry, but I cant' find proxy-pac-file \"#{env['sinatra.error'].message}\"."
    end

    get '/' do
      redirect to('/v1/pac/proxy.pac')
    end

    get '/v1/pac/:name' do
      manager = PacManager.new
      file = manager.find(params[:name])

      if file.nil?
        fail Sinatra::NotFound, params[:name]
      else
        file.content 
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
local_pac-0.0.4 lib/local_pac/file_server.rb
local_pac-0.0.3 lib/local_pac/file_server.rb
local_pac-0.0.2 lib/local_pac/file_server.rb
local_pac-0.0.1 lib/local_pac/file_server.rb