Comments (9)
Hi Wes,
Sorry for the long delay... This really comes down to a deficiency in the current callback interface, whether we say 20x is success or 30x is failure just means we really can't easily classify response codes binary as success or failure... I suggest using the on_complete callback...
from curb.
No worries. I ended up implementing using the on_complete callback and having it check in the on_failure callback to ignore if it was a 304 response code.
from curb.
Maybe for future releases the right thing to do here would be to add a on_redirect, and on_missing callback?
from curb.
Thats a good idea. Maybe define the set callbacks more specific for the various status response groups:
2xx codes on_success
3xx codes on_redirect
4xx codes on_missing
5xx codes on _failure
One thing that might get somewhat confusing is that network connection, DNS failed lookups, and 5xx reponse codes are getting grouped in on_failure callback. Not sure if you want to break those out in a separate ones or not.
Another possible solution is to add callbacks for each of the response status codes - on_200, on_301, on_404. This way the developer can be very specific as to how they want to handle each of the status codes.
from curb.
Okay, I'm thinking something such as. easy.on("304") {|c| ... } etc... There is a bit of overhead in this but I think it's not huge. Will update as I make progress
from curb.
Any updates on this? Thanks.
from curb.
will work on this for the 0.8 series... porting more c code to ruby will make this kind of interface easier to implement.
from curb.
Awesome, Todd! Thank you!
from curb.
for 0.8 release on_redirect and on_missing will be included in addition to on_success, on_failure and on_complete.
from curb.
Related Issues (20)
- unwanted space in tests/tc_curl_easy.rb? (line 24) HOT 1
- Sponsoring HOT 1
- Ubuntu 18.04 and up
- Not possible to remove the Host header HOT 1
- "error: static declaration of βrb_io_stdio_fileβ follows non-static declaration" when installing on Ubuntu 16.04 and Ruby 2.7.1 HOT 1
- Can't set CURLOPT_IPRESOLVE HOT 1
- Please fix license on rubygems.org, it says MIT HOT 1
- on_failure receive incorrect argument HOT 1
- README: Change URLs to be to curl.se HOT 1
- New version request HOT 4
- Is CURLOPT_REQUEST_TARGET needed for Request-URI different than Host header? HOT 2
- Library not loaded: @rpath/libgssapi_krb5.2.2.dylib HOT 1
- Hello, I am new into coding, so i was trying to set up environment for ESG-BERT: https://github.com/mukut03/ESG-BERT using pytorch, but i am unable to solve this error on windows using anaconda, the server is running but unhealthy. Error(ESG-BERT) C:\Users\Administrator\anaconda3\envs\ESG-BERT>curl http://localhost:8080/ping { "status": "Unhealthy" }
- [BUG] Segmentation fault with Ruby 2.3 & curb 1.0.1 HOT 1
- LICENSE file contents does not match MIT license in the gemspec file HOT 1
- Gem install fails in windows 10 wsl v1 HOT 1
- Build against curl-impersonate HOT 1
- Investigate Ruby T_DATA warning HOT 1
- Segfault in Multi after upgrading to v1.0.3 HOT 5
- CURLOPT_NOPROXY not supported
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from curb.