lib/grape/dsl/inside_route.rb in grape-0.17.0 vs lib/grape/dsl/inside_route.rb in grape-0.18.0

- old
+ new

@@ -95,12 +95,11 @@ # # @param url [String] The url to be redirect. # @param options [Hash] The options used when redirect. # :permanent, default false. # :body, default a short message including the URL. - def redirect(url, options = {}) - permanent = options.fetch(:permanent, false) - body_message = options.fetch(:body, nil) + def redirect(url, permanent: false, body: nil, **_options) + body_message = body if permanent status 301 body_message ||= "This resource has been moved permanently to #{url}." elsif env[Grape::Http::Headers::HTTP_VERSION] == 'HTTP/1.1' && request.request_method.to_s.upcase != Grape::Http::Headers::GET status 303