Permalink
Browse files

Pull out the content-type from Sprockets. If that fails, default to u…

…sing Mime.mime_type.
  • Loading branch information...
1 parent 87fa6d2 commit 93240fac1a6acc7fed98ba763d363f03d435fd27 Jared Carroll, Rob Pak & Scott Gonyea committed Oct 13, 2011
Showing with 5 additions and 2 deletions.
  1. +5 −2 lib/jasmine-sprockets/jasmine_file.rb
View
7 lib/jasmine-sprockets/jasmine_file.rb
@@ -10,13 +10,16 @@ def sprocket
end
def serving
- body = [sprocket[@path].to_s]
+ base = sprocket[@path]
+ ctype = base.content_type
+
+ body = [base.to_s]
size = Utils.bytesize(body.first)
[200, {
"Last-Modified" => F.mtime(@path).httpdate,
"Cache-Control" => "must-revalidate",
- "Content-Type" => Mime.mime_type(F.extname(@path), 'text/plain'),
+ "Content-Type" => ctype || Mime.mime_type(F.extname(@path), 'text/plain'),
"Content-Length" => size.to_s
}, body]
end

0 comments on commit 93240fa

Please sign in to comment.