Sha256: a9739e1fffc78062664d33734a3327a147579904fa628ddb7fc51bf117a12a17
Contents?: true
Size: 435 Bytes
Versions: 11
Compression:
Stored size: 435 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[ '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