HTTPie in ubuntu prints 404 warning but quietmode is enabled

14 Views Asked by At

I spending whole day to fix this problem. We are using a webservice and need to initial create some things via REST api. If the job was running one time we can't recreate the objects and get an 409 error. The whole job is running in kubernetes and the job always restart because 409 returns not-0-exitcode.

I am running now with || true but if we now get an error the job don't retry, what should be do because if there any other problem with network for example we need the retry or the notification that something is wrong.

Now I try to request a created object, if I get an 404 error there is no object already existing and I run the job. If there is no 404 error I exit the job with exit 0. I don't check the error code, I parse the response json and if the json item null I know there is an 404. I do a string compare check.

This works fine but httpie always print http: warning: HTTP 404 Not Found if the object not exists. I am using -q flag but this is do nothing.

http --check-status --ignore-stdin -q GET hallo.de/abcdef

This is an example. Also try with 2> /dev/null to print the warning to nirvana but than I never get an answer. But I need the answer as json if the object exists. With 2> /dev/null I never can check if the response ok.

I searching some solutions just to get the response code but help of httpie has nothing about statuscode.

I found nothing in the internet because always there are talking about the python lib "httpie" and never about the implemented ubuntu package. cURL is not an option, we must use httpie.

0

There are 0 best solutions below