From 6a97de5979e1f3455372d7571b8395141dcfa556 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= <jeremy@asynk.ch>
Date: Thu, 5 Jan 2012 09:34:10 +0100
Subject: Node: engine proc may return mime-type

---
 lib/zorglub/node.rb | 9 +++++----
 1 file 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
-- 
cgit v1.1-2-g2b99