File tree Expand file tree Collapse file tree 4 files changed +10
-4
lines changed
Expand file tree Collapse file tree 4 files changed +10
-4
lines changed Original file line number Diff line number Diff line change 33#### Features
44
55* Your contribution here.
6+ * [ #1942 ] ( https://github.com/ruby-grape/grape/pull/1942 ) : Optimized retained memory methods - [ @ericproulx ] ( https://github.com/ericproulx ) .
67* [ #1941 ] ( https://github.com/ruby-grape/grape/pull/1941 ) : Frozen string literal - [ @ericproulx ] ( https://github.com/ericproulx ) .
78* [ #1940 ] ( https://github.com/ruby-grape/grape/pull/1940 ) : Get rid of a needless step in HashWithIndifferentAccess - [ @dnesteryuk ] ( https://github.com/dnesteryuk ) .
89* [ #1938 ] ( https://github.com/ruby-grape/grape/pull/1938 ) : Add project metadata to the gemspec - [ @orien ] ( https://github.com/orien ) .
Original file line number Diff line number Diff line change @@ -26,6 +26,10 @@ module Headers
2626 HTTP_ACCEPT = 'HTTP_ACCEPT'
2727
2828 FORMAT = 'format'
29+
30+ def self . find_supported_method ( route_method )
31+ Grape ::Http ::Headers ::SUPPORTED_METHODS . detect { |supported_method | supported_method . casecmp ( route_method ) . zero? }
32+ end
2933 end
3034 end
3135end
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ def compile!
4646 end
4747
4848 def append ( route )
49- map [ route . request_method . to_s . upcase ] << route
49+ map [ route . request_method ] << route
5050 end
5151
5252 def associate_routes ( pattern , **options )
Original file line number Diff line number Diff line change @@ -64,12 +64,13 @@ def route_path
6464 end
6565
6666 def initialize ( method , pattern , **options )
67- upcased_method = method . to_s . upcase
67+ method_s = method . to_s
68+ method_upcase = Grape ::Http ::Headers . find_supported_method ( method_s ) || method_s . upcase
6869
6970 @suffix = options [ :suffix ]
70- @options = options . merge ( method : upcased_method )
71+ @options = options . merge ( method : method_upcase )
7172 @pattern = Pattern . new ( pattern , **options )
72- @translator = AttributeTranslator . new ( **options , request_method : upcased_method )
73+ @translator = AttributeTranslator . new ( **options , request_method : method_upcase )
7374 end
7475
7576 def exec ( env )
You can’t perform that action at this time.
0 commit comments