Skip to content
Browse files

RackRequest#content_type should return Mime::Type

  • Loading branch information...
1 parent 8b306bf commit 0f8206104e5dfca1024d1f6bc12a8783c00527e2 @lifo lifo committed Jul 16, 2008
Showing with 13 additions and 1 deletion.
  1. +1 −1 actionpack/lib/action_controller/rack_process.rb
  2. +12 −0 actionpack/test/controller/rack_test.rb
View
2 actionpack/lib/action_controller/rack_process.rb
@@ -24,7 +24,7 @@ def initialize(env, session_options = DEFAULT_SESSION_OPTIONS)
super()
end
- %w[ AUTH_TYPE CONTENT_TYPE GATEWAY_INTERFACE PATH_INFO
+ %w[ AUTH_TYPE GATEWAY_INTERFACE PATH_INFO
PATH_TRANSLATED QUERY_STRING REMOTE_HOST
REMOTE_IDENT REMOTE_USER SCRIPT_NAME
SERVER_NAME SERVER_PROTOCOL
View
12 actionpack/test/controller/rack_test.rb
@@ -166,6 +166,18 @@ def test_doesnt_interpret_request_uri_as_query_string_when_missing
end
end
+class RackRequestContentTypeTest < BaseRackTest
+ def test_html_content_type_verification
+ @request.env['CONTENT_TYPE'] = Mime::HTML.to_s
+ assert @request.content_type.verify_request?
+ end
+
+ def test_xml_content_type_verification
+ @request.env['CONTENT_TYPE'] = Mime::XML.to_s
+ assert !@request.content_type.verify_request?
+ end
+end
+
class RackRequestNeedsRewoundTest < BaseRackTest
def test_body_should_be_rewound
data = 'foo'

0 comments on commit 0f82061

Please sign in to comment.
Something went wrong with that request. Please try again.