sinatra-inspired DSL for client-side HTTP

T

Tom Metge

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

http://github.com/tommetge/httprb

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'
# =3D> #<Net::HTTPOK 200 OK readbody=3Dtrue>

more complicated example (with custom headers and such):

res =3D get 'www.google.com' do |req|
req.header "x-some-key", "some value"
req.header "x-some-other-key", "some other value"
end
# =3D> #<Net::HTTPOK 200 OK readbody=3Dtrue>

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

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

tom=
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top