RackRequest#content_type should return Mime::Type

This commit is contained in:
Pratik Naik 2008-07-16 03:18:09 +01:00
parent 8b306bf24c
commit 0f8206104e
2 changed files with 13 additions and 1 deletions

@ -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

@ -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'