diff --git a/lib/newark/app.rb b/lib/newark/app.rb index 1c2889c..c9aaaf5 100644 --- a/lib/newark/app.rb +++ b/lib/newark/app.rb @@ -76,6 +76,11 @@ def params request.params end + def redirect_to path + @response.status=302 + headers['Location']=path + '' + end def route route = match_route diff --git a/lib/newark/response.rb b/lib/newark/response.rb index 2412697..488c46a 100644 --- a/lib/newark/response.rb +++ b/lib/newark/response.rb @@ -5,6 +5,7 @@ class Response < Rack::Response def body=(value) value = if value.respond_to?(:to_str) + header["Content-Type"] = "text/html;charset=utf8" if nil == headers["Content-Type"] [ value.to_str ] elsif value.respond_to?(:to_hash) && defined?(MultiJson) header['Content-Type'] = JSON_MIME_TYPE