Use --output and --print options to send both Response header and body to a file.
Syntax
http --output={fileName} --print=hb {URL}
$http --output=out.txt --print=hb http://localhost:8080/public/v1/guests
$
$cat out.txt
HTTP/1.1 200
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Date: Fri, 02 Aug 2019 15:21:41 GMT
[{"id":5,"firstName":"ram","lastName":"krishna"}]
This post first appeared on Java Tutorial : Blog To Learn Java Programming, please read the originial post: here