Skip to content

Commit

Permalink
Treat an empty content type as nil content type (issue rack#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich Meyers committed Aug 11, 2010
1 parent b986567 commit e70161d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/rack/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ def path_info; @env["PATH_INFO"].to_s end
def request_method; @env["REQUEST_METHOD"] end
def query_string; @env["QUERY_STRING"].to_s end
def content_length; @env['CONTENT_LENGTH'] end
def content_type; @env['CONTENT_TYPE'] end

def content_type
content_type = @env['CONTENT_TYPE']
content_type.nil? || content_type.empty? ? nil : content_type
end

def session; @env['rack.session'] ||= {} end
def session_options; @env['rack.session.options'] ||= {} end
def logger; @env['rack.logger'] end
Expand Down

0 comments on commit e70161d

Please sign in to comment.