Sha256: 9b7e31dac687abe592335f137b5528a008a1d5b4913d89983e45e94119524019
Contents?: true
Size: 492 Bytes
Versions: 11
Compression:
Stored size: 492 Bytes
Contents
module CubaApi class Ext2MimeRack def initialize( app, *allowed) @app = app @allowed = allowed end def call(env) ext = env[ 'PATH_INFO' ].sub( /.*\./, '' ) if ext && @allowed.member?( ext ) mime = Rack::Mime.mime_type( '.' + ext ) env[ 'PATH_INFO_ORIG' ] = env[ 'PATH_INFO' ].dup env[ 'HTTP_ACCEPT' ] = mime env[ 'PATH_INFO' ].sub!( /\..*/, '' ) end status, headers, body = @app.call(env) end end end
Version data entries
11 entries across 11 versions & 1 rubygems