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
body_message ||= "An alternate resource is located at #{url}."
else
status 302
body_message ||= "This resource has been moved temporarily to #{url}."
end
header 'Location', url
content_type 'text/plain'
body body_message
end