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 3
3
#### Features
4
4
5
5
* Your contribution here.
6
+ * [ #1942 ] ( https://github.com/ruby-grape/grape/pull/1942 ) : Optimized retained memory methods - [ @ericproulx ] ( https://github.com/ericproulx ) .
6
7
* [ #1941 ] ( https://github.com/ruby-grape/grape/pull/1941 ) : Frozen string literal - [ @ericproulx ] ( https://github.com/ericproulx ) .
7
8
* [ #1940 ] ( https://github.com/ruby-grape/grape/pull/1940 ) : Get rid of a needless step in HashWithIndifferentAccess - [ @dnesteryuk ] ( https://github.com/dnesteryuk ) .
8
9
* [ #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
26
26
HTTP_ACCEPT = 'HTTP_ACCEPT'
27
27
28
28
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
29
33
end
30
34
end
31
35
end
Original file line number Diff line number Diff line change @@ -46,7 +46,7 @@ def compile!
46
46
end
47
47
48
48
def append ( route )
49
- map [ route . request_method . to_s . upcase ] << route
49
+ map [ route . request_method ] << route
50
50
end
51
51
52
52
def associate_routes ( pattern , **options )
Original file line number Diff line number Diff line change @@ -64,12 +64,13 @@ def route_path
64
64
end
65
65
66
66
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
68
69
69
70
@suffix = options [ :suffix ]
70
- @options = options . merge ( method : upcased_method )
71
+ @options = options . merge ( method : method_upcase )
71
72
@pattern = Pattern . new ( pattern , **options )
72
- @translator = AttributeTranslator . new ( **options , request_method : upcased_method )
73
+ @translator = AttributeTranslator . new ( **options , request_method : method_upcase )
73
74
end
74
75
75
76
def exec ( env )
You can’t perform that action at this time.
0 commit comments