Permalink
Browse files

Support session flags for cookie sessions in Camping 2.0

  • Loading branch information...
1 parent 01c9515 commit 5ef37ab84f2c335f0e5dc68bbdcca03ba8de491c @julik julik committed Nov 16, 2008
Showing with 8 additions and 3 deletions.
  1. +8 −3 lib/mosquito.rb
View
11 lib/mosquito.rb
@@ -503,7 +503,7 @@ def send_request(composite_url, post_vars, method)
# Run the request.
@response = if app_module.respond_to?(:run) # Camping < 2.0
app_module.run(*@request.to_camping_args)
- else # Camping 2.0
+ else # Camping 2.0
app_module.call(@request.to_rack_request).pop # Serve a Rack::Response object
end
@@ -577,8 +577,13 @@ def upload(filename)
# Checks that Camping sent us a cookie to attach a session
def assert_session_started
- assert_not_nil @cookies["camping_sid"],
- "The session ID cookie was empty although session should have started"
+ if Camping.respond_to?(:call) # Camping 2.0 prefers cookie sessions
+ assert_not_nil @cookies["camping_hash"],
+ "The session hash cookie was empty although session should have started"
+ else
+ assert_not_nil @cookies["camping_sid"],
+ "The session ID cookie was empty although session should have started"
+ end
end
# The reverse of +assert_session_started+

0 comments on commit 5ef37ab

Please sign in to comment.