lib/grape/dsl/inside_route.rb
# Redirect to a new url.
#
# @param url [String] The url to be redirect.
# @param options [Hash] The options used when redirect.
#                       :permanent, default false.
Redirect to a new url.
Redirect to a new url .
def redirect(url, options = {})
        merged_options = { permanent: false }.merge(options)
        if merged_options[:permanent]
          status 301
        else
          if env['HTTP_VERSION'] == 'HTTP/1.1' && request.request_method.to_s.upcase != 'GET'
            status 303
          else
            status 302
          end
        end
        header 'Location', url
        body ''
      end
def redirect ( url , options = { } ) merged_options = { permanent : false } . merge ( options ) if merged_options [ :permanent ] status 301 else if env [ 'HTTP_VERSION' ] == 'HTTP/1.1' && request . request_method . to_s . upcase != 'GET' status 303 else status 302 end end header 'Location' , url body '' end
Redirect to a new url.
Redirect to a new url .
url
The url to be redirect.
The url to be redirect .
options
The options used when redirect. :permanent, default false.
The options used when redirect . : permanent default false .