Skip to content

Commit

Permalink
Merge 29bad9b into 3f17a27
Browse files Browse the repository at this point in the history
  • Loading branch information
ericproulx committed Feb 14, 2020
2 parents 3f17a27 + 29bad9b commit ab94037
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/grape/api/instance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def add_head_not_allowed_methods_and_options_methods
allowed_methods |= [Grape::Http::Headers::HEAD] if allowed_methods.include?(Grape::Http::Headers::GET)
end

allow_header = (self.class.namespace_inheritable(:do_not_route_options) ? allowed_methods : [Grape::Http::Headers::OPTIONS] | allowed_methods).join(', ')
allow_header = (self.class.namespace_inheritable(:do_not_route_options) ? allowed_methods : [Grape::Http::Headers::OPTIONS] | allowed_methods)

unless self.class.namespace_inheritable(:do_not_route_options) || allowed_methods.include?(Grape::Http::Headers::OPTIONS)
config[:endpoint].options[:options_route_enabled] = true
Expand Down
4 changes: 2 additions & 2 deletions lib/grape/router.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def transaction(env)
env,
neighbor.allow_header,
neighbor.endpoint
) if neighbor && method == 'OPTIONS' && !cascade
) if neighbor && method == Grape::Http::Headers::OPTIONS && !cascade

route = match?(input, '*')
return neighbor.endpoint.call(env) if neighbor && cascade && route
Expand Down Expand Up @@ -160,7 +160,7 @@ def greedy_match?(input)
end

def call_with_allow_headers(env, methods, endpoint)
env[Grape::Env::GRAPE_ALLOWED_METHODS] = methods
env[Grape::Env::GRAPE_ALLOWED_METHODS] = methods.join(', ')
endpoint.call(env)
end

Expand Down

0 comments on commit ab94037

Please sign in to comment.