cURL / Mailing Lists / curl-users / Single Mail

curl-users

FR - showing body when run "curl -f"

From: Alexey Melezhik <melezhik_at_gmail.com>
Date: Tue, 1 Mar 2016 12:25:34 +0300

Hi!

Based on https://github.com/curl/curl/issues/687

I know how curl -f acts, and I know how curl -w acts as well. But
both cases are not good, easy to use for me.

I need behavior like with curl -f , meaning correct exit code and in
case I handle this - immediate break of my script. But I still need a
body. Many modern rest API, web applications return vital information
via body when return none successful http code. curl -s -o /dev/null
-w "%{http_code}\n" is possible workaround but it still requires
additional bash code to verify http status which is neither convenient
nor good code style , I try to avoid such bash-isms which eventually
make code hard to maintain.

I need a curl -f behavior plus http body at output, you don't have to
change current implementation, we may talk about additional flag ,
something like --with-body or whatever proper for you. Is this a big
deal ? Most part of job is done, I mean curl -f implementation already
here , some extra prices is left, but thus would make curl more
helpful ;-))))
-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-users
FAQ: https://curl.haxx.se/docs/faq.html
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2016-03-01