Sunday, 18 August 2019

HTTPie: Send request headers

You can send the request headers using the notation ‘HeaderName:Value’.

Syntax
http {url} header1:value1 header2:value2....headerN:valueN

Example
$http http://localhost:8080/public/v1/guests Accept:application/xml

$http POST http://localhost:8080/public/v1/guests/ firstName=ram lastName=ponnam
HTTP/1.1 201 
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Content-Type: application/json;charset=UTF-8
Date: Fri, 02 Aug 2019 13:59:17 GMT
Expires: 0
Pragma: no-cache
Transfer-Encoding: chunked
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block

{
    "firstName": "ram",
    "id": 5,
    "lastName": "ponnam"
}
$
$
$http http://localhost:8080/public/v1/guests Accept:application/xml
HTTP/1.1 200 
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Content-Type: application/xml;charset=UTF-8
Date: Fri, 02 Aug 2019 13:59:29 GMT
Expires: 0
Pragma: no-cache
Transfer-Encoding: chunked
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block

<List><item><id>5</id><firstName>ram</firstName><lastName>ponnam</lastName></item></List>


Previous                                                    Next                                                    Home

No comments:

Post a Comment