Skip to content

Commit

Permalink
Refactored Rack::Request#media_type
Browse files Browse the repository at this point in the history
No need for subscript, first reads better

Signed-off-by: Christian Neukirchen <chneukirchen@gmail.com>
  • Loading branch information
tj authored and leahneukirchen committed Mar 19, 2009
1 parent aa567e2 commit 939fa7d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rack/request.rb
Expand Up @@ -46,7 +46,7 @@ def content_type; @env['CONTENT_TYPE'] end
# For more information on the use of media types in HTTP, see:
# http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7
def media_type
content_type && content_type.split(/\s*[;,]\s*/, 2)[0].downcase
content_type && content_type.split(/\s*[;,]\s*/, 2).first.downcase
end

# The media type parameters provided in CONTENT_TYPE as a Hash, or
Expand Down

0 comments on commit 939fa7d

Please sign in to comment.