Created
March 14, 2009 03:31
-
-
Save vangberg/78910 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "sinatra" | |
post "/foo" do | |
redirect "/bar" | |
end | |
get "/bar" do | |
"Hello, World!" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rest_client" | |
RestClient.post "http://localhost:9393/foo", {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# the server | |
~/c/s/rest> shotgun app.rb | |
== Shotgun starting Rack::Handler::Mongrel on 0.0.0.0:9393 | |
127.0.0.1 - - [14/Mar/2009 04:31:09] "POST /foo HTTP/1.1" 302 - 0.0008 | |
127.0.0.1 - - [14/Mar/2009 04:31:09] "POST /foo HTTP/1.1" 302 - 0.0010 | |
127.0.0.1 - - [14/Mar/2009 04:31:09] "POST /bar HTTP/1.1" 404 413 0.0008 | |
127.0.0.1 - - [14/Mar/2009 04:31:09] "POST /bar HTTP/1.1" 404 413 0.0010 | |
# the client | |
~/c/s/rest> ruby -rubygems getit.rb | |
/Users/h/.gems/gems/rest-client-0.9.2/lib/restclient/request.rb:142:in `process_result': Resource not found (RestClient::ResourceNotFound) | |
from /Users/h/.gems/gems/rest-client-0.9.2/lib/restclient/request.rb:106:in `transmit' | |
from /opt/local/lib/ruby/1.8/net/http.rb:543:in `start' | |
from /Users/h/.gems/gems/rest-client-0.9.2/lib/restclient/request.rb:103:in `transmit' | |
from /Users/h/.gems/gems/rest-client-0.9.2/lib/restclient/request.rb:36:in `execute_inner' | |
from /Users/h/.gems/gems/rest-client-0.9.2/lib/restclient/request.rb:28:in `execute' | |
from /Users/h/.gems/gems/rest-client-0.9.2/lib/restclient/request.rb:31:in `execute' | |
from /Users/h/.gems/gems/rest-client-0.9.2/lib/restclient/request.rb:12:in `execute' | |
from /Users/h/.gems/gems/rest-client-0.9.2/lib/restclient.rb:61:in `post' | |
from getit.rb:3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment