require 'sinatra'
set :port, 8080
get '/get' do
"GET Hello World"
end
post '/post' do
"POST Hello World"
end
require "rest-client"
response = RestClient.post 'http://localhost:8080/post', {param1: 'one'}
puts response
curl -v -X POST http://localhost:8080/post
use REST::Client;
my $client = REST::Client->new();
$client->GET('http://localhost:8080/get');
print $client->responseContent();
or
use warnings;
use LWP::UserAgent;
use HTTP::Request;
my $ua = LWP::UserAgent->new;
my $req = HTTP::Request->new( GET => 'http://localhost:8080/get');
my $response = $ua->request($req);
print $response->code . "\n";
--
You received this message because you are subscribed to the Google Groups "sinatrarb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sinatrarb+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.