Skip to content

Instantly share code, notes, and snippets.

@shelling
Created January 5, 2012 08:15
Show Gist options
  • Select an option

  • Save shelling/1564225 to your computer and use it in GitHub Desktop.

Select an option

Save shelling/1564225 to your computer and use it in GitHub Desktop.
redirect browser to post
require 'rubygems'
require 'sinatra/base'
class App < Sinatra::Base
get "/" do
redirect "/hello.html"
end
post "/" do
params.inspect
end
end
run App
<html>
<head>
<script>
window.onload = function() { document.forms[0].submit() };
</script>
</head>
<body>
<form action="/" method="post">
<input type="hidden" name="hello" value="world">
<input type="submit" value="submit">
</form>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment