repo.or.cz
/
metropolis.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
history
|
raw
|
HEAD
add suffix_mime output filter
[metropolis.git]
/
lib
/
metropolis
/
suffix_mime.rb
blob
76a3f96e96ee6d5413081cc0ef5b29b3b7fe90b5
1
module Metropolis::SuffixMime
2
MIME_TYPES = Rack::Mime::MIME_TYPES
3
4
def get(key, env)
5
set_mime(key, super)
6
end
7
8
def head(key, env)
9
set_mime(key, super)
10
end
11
12
def set_mime(key, response)
13
status, headers, _ = response
14
200 == status && /(\.[^\.]+)\z/ =~ key and
15
type = MIME_TYPES[$1] and headers["Content-Type"] = type
16
response
17
end
18
end