Issue with on_success and on_failure

Skip to first unread message


Sep 5, 2010, 1:13:17 PM9/5/10
to Curb - Ruby libcurl Bindings
I am testing a script , and I wrote the success/failure checking as
following :

request ="#{resource_uri}") do |curl|
curl.headers["X-TrackerToken"] = @token
curl.on_success do |response|
# doing some funny thing
curl.on_failure do |response, err|
print "We have failure. The response code is
print "Error is: #{err.inspect}\n"

I am testing against, which returns a 302 code by
with this coding an error is raised ... which should not be ( it's not
a failure ..)

We have failure. The response code is 302
Error is: [Curl::Err::CurlOK, "No error"]

how should I write my code to pass this test ?

Todd Fisher

Sep 6, 2010, 11:27:12 AM9/6/10
Hi If you add 

curl.follow_location = true

Does it work?

You received this message because you are subscribed to the Google Groups "Curb - Ruby libcurl Bindings" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

Todd Fisher

Sep 6, 2010, 10:20:57 PM9/6/10
Yes, I've just updated the README on github here:

The gist is 20x trigger a on_success, anything else is on_failure  and to assert response code/status on your own use on_complete.

On Mon, Sep 6, 2010 at 1:21 PM, <> wrote:
I added curl.on_complete and it works.. ( the redirection is only during tests on, )

is there any place ( link) where I can find some info on the on the different callbacks ? are they listed somewhere in the gem ?

thanks a lot

Le , Todd Fisher <> a écrit :
Reply all
Reply to author
0 new messages