Sha256: 33d9e7c3f9dd62d62f998c3af0fc24cc42d755e79fa10af3bd28dc0ca3a328b8
Contents?: true
Size: 812 Bytes
Versions: 8
Compression:
Stored size: 812 Bytes
Contents
module LocalPac class FileServer < Sinatra::Base use Rack::Deflater configure do if settings.environment == :test require_relative 'spec_helper_file_server' SpecHelperFileServer.new end set :local_storage, LocalPac::LocalStorage.new end configure do mime_type :proxy_pac_file, 'application/x-ns-proxy-autoconfig' end 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 content_type :proxy_pac_file file = settings.local_storage.find(params[:name]) if file.nil? fail Sinatra::NotFound, params[:name] else file.compressed_content end end end end
Version data entries
8 entries across 8 versions & 1 rubygems