summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2012-01-05 09:34:10 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2012-01-05 09:34:10 +0100
commit6a97de5979e1f3455372d7571b8395141dcfa556 (patch)
tree70e7e4e36428c07d9bc5b457cc358a3dfdde5821
parentb4cef552e3d615e84199ed0f2abf74f8a4ea4001 (diff)
downloadzorglub-6a97de5979e1f3455372d7571b8395141dcfa556.zip
zorglub-6a97de5979e1f3455372d7571b8395141dcfa556.tar.gz
Node: engine proc may return mime-type
-rw-r--r--lib/zorglub/node.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/zorglub/node.rb b/lib/zorglub/node.rb
index 3687adc..2e46bdf 100644
--- a/lib/zorglub/node.rb
+++ b/lib/zorglub/node.rb
@@ -95,7 +95,7 @@ module Zorglub
#
end
#
- attr_reader :options, :request, :response, :content
+ attr_reader :options, :request, :response, :content, :mime
#
def initialize env, options
@env = env
@@ -108,6 +108,7 @@ module Zorglub
catch(:stop_realize) {
feed!
response.write @content
+ response.header['Content-Type'] = @mime||'text/html'
response.finish
response
}
@@ -120,13 +121,13 @@ module Zorglub
@content = self.send @options[:method], *@options[:args]
v, l, e = view, layout, Config.engine_proc(@options[:engine])
state (@options[:layout].nil? ? :partial : :view)
- @content, = e.call v, self if e and File.exists? v
+ @content, @mime = e.call v, self if e and File.exists? v
state :layout
- @content, = e.call l, self if e and File.exists? l
+ @content, @mime = e.call l, self if e and File.exists? l
state :post_cb
Node.call_after_hooks self
state :finished
- @content
+ return @content, @mime
end
#
def redirect target, options={}, &block