Sunday 18 August 2019

HTTPie: Write both response headers and data to a file


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"}]



Previous                                                    Next                                                    Home

No comments:

Post a Comment