I have something like this:
post "/login" do
end
get "/login" do
end
post "/register" do
...
redirect "/login" # I would like to redirect to get "/login" instead of post "login"
end
Can I tell sinatra that I want to use get, and not have it implicitly select "post" ?
Most browsers will reset to GET with a 302 (default) redirect. If you're up against a browser that is actually doing the correct thing and NOT changing the request method, you can force it to change with a 303.
redirect '/login', 303
Source: http://www.gittr.com/index.php/archive/details-of-sinatras-redirect-helper/
来源:https://stackoverflow.com/questions/4726884/can-you-specify-the-http-method-to-use-with-sinatras-redirect