Skip to content

Commit

Permalink
eagerly populate the http method loookup cache so we don't need locks
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Oct 18, 2012
1 parent 13655a4 commit 872d8c3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion actionpack/lib/action_dispatch/http/request.rb
Expand Up @@ -70,7 +70,13 @@ def key?(key)
RFC5789 = %w(PATCH)

HTTP_METHODS = RFC2616 + RFC2518 + RFC3253 + RFC3648 + RFC3744 + RFC5323 + RFC5789
HTTP_METHOD_LOOKUP = Hash.new { |h, m| h[m] = m.underscore.to_sym if HTTP_METHODS.include?(m) }

HTTP_METHOD_LOOKUP = {}

# Populate the HTTP method lookup cache
HTTP_METHODS.each { |method|
HTTP_METHOD_LOOKUP[method] = method.underscore.to_sym
}

# Returns the HTTP \method that the application should see.
# In the case where the \method was overridden by a middleware
Expand Down

0 comments on commit 872d8c3

Please sign in to comment.