Мне удалось получить ответ сервера в случае 404
, 503
ошибок с wget 1.20.1
с помощью следующей команды:
wget --no-verbose --save-headers --content-on-error=on --timeout=3 --tries=1 -O- http://127.0.0.1:8080/bla
Пример вывода:
HTTP/1.1 404 Not Found
X-Endpoint-Path: GET /bla
X-Sub-Calls-Count: 0
X-Mdc: XNIO-1 task-11550846786294
X-Child-Calls-Count: 0
X-Hop: 1
Date: Fri, 22 Feb 2019 14:46:26 GMT
Connection: keep-alive
Transfer-Encoding: chunked
Content-Type: application/json;charset=UTF-8
{"id":"266a8c43-81ae-4b73-bb0c-d3e0a37a11c4","createdAt":1550846786327,"httpCode":404,"code":"RESOURCE_NOT_FOUND","message":"RESTEASY003210: Could not find resource for full path: http://127.0.0.1:8080/bla"}http://127.0.0.1:8080/bla:
2019-02-22 15:46:26 ERROR 404: Not Found.
Используйте:
fmt -w 65 file |sed -e 's/^>//' -e 's/^/>/'
образец вывода:
>Mozilla Thunderbird is a free and open-source cross-platform
>email client, personal information manager, news client,
>RSS and chat client developed by the Mozilla Foundation. The
>project strategy was originally modeled after that of the
>Mozilla Firefox web browser.