Sinatra-inspired DSL for client-side HTTP

we get a ton of these little posts, but i genuinely thought someone
might find this useful (i certainly do):

i’ve had to do more than my fair share of work with net/http and it
sucks. because most of us spend more time writing web apps/services
than we do consuming them in ruby, we have beautiful DSLs like sinatra
to help us. it’s about time we had the same for client work.

example:

get ‘www.google.com

=> #<Net::HTTPOK 200 OK readbody=true>

more complicated example (with custom headers and such):

res = get ‘www.google.com’ do |req|
req.header “x-some-key”, “some value”
req.header “x-some-other-key”, “some other value”
end

=> #<Net::HTTPOK 200 OK readbody=true>

you get the idea. feedback welcome. really, i mean that. lay in- i
can take it :slight_smile:

oh, one important note: unfortunately, this stomps all over sinatra
(obviously) so they can’t be used together- for now.

tom

On Fri, Oct 29, 2010 at 10:49 PM, Tom M. [email protected]
wrote:

GitHub - tommetge/httprb: http the ruby way: rack and sinatra inspired DSL for client-side HTTP

awesome. can’t wait for the gem to crystalize =)
thanks for httprb and best regards -botp