Permalink
Browse files

Return arrays rather than rack responses.

Pretty sure this is more correct.
  • Loading branch information...
jnunemaker committed Feb 19, 2013
1 parent 316101d commit 81a65776ed14adf4082ca87f336e1d22f29dd8cf
Showing with 6 additions and 8 deletions.
  1. +6 −8 lib/flipper/ui/action.rb
View
@@ -21,7 +21,7 @@ def self.route(regex)
# flipper - The Flipper::DSL instance.
# request - The Rack::Request that was sent.
#
- # Returns result of Action#run (should be a Rack::Response usually).
+ # Returns result of Action#run.
def self.run(flipper, request)
new(flipper, request).run
end
@@ -86,7 +86,7 @@ def run_other_action(action_class)
# Public: Call this with a response to immediately stop the current action
# and respond however you want.
#
- # response - The Rack::Response you would like to return.
+ # response - The response you would like to return.
def halt(response)
throw :halt, response
end
@@ -95,25 +95,23 @@ def halt(response)
#
# name - The Symbol name of the view.
#
- # Returns a Rack::Response.
+ # Returns a response.
def view_response(name)
header 'Content-Type', 'text/html'
body = view_with_layout { view_without_layout name }
-
- Rack::Response.new(body, @code, @headers)
+ [@code, @headers, body]
end
# Public: Dumps an object as json and returns rack response with that as
# the body. Automatically sets Content-Type to "application/json".
#
# object - The Object that should be dumped as json.
#
- # Returns a Rack::Response.
+ # Returns a response.
def json_response(object)
header 'Content-Type', 'application/json'
body = MultiJson.dump(object)
-
- Rack::Response.new(body, @code, @headers)
+ [@code, @headers, body]
end
# Public: Set the status code for the response.

0 comments on commit 81a6577

Please sign in to comment.