Example 7-9 Basic Auth Using curl
Click here to view code image
$ curl -sD - -X GET https://postman-
echo.com/basic-auth -H 'authorization: Basic
cG9zdG1hbjpwYXNzd29yZA==' -H 'cache-control:
no-cache'
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Date: Tue, 27 Aug 2019 05:21:00 GMT
ETag: W/"16-sJz8uwjdDv0wvm7//BYdNw8vMbU"
Server: nginx
set-cookie: sails.sid=s%3A4i3UW5-
DQCMpey8Z1Ayrqq0izt4KZR5-.Bl8QDnt44B690E8J06qyC-
s8oyCLpUfEsFxLEFTSWSC4; Path=/; HttpOnly
Vary: Accept-Encoding
Content-Length: 22
Connection: keep-alive
{"authenticated":true}
HTTPie
HTTPie is a modern, user-friendly, and cross-platform
command-line HTTP client written in Python. It is
designed to make CLI interaction with web services easy
and user friendly. Its simple HTTP commands enable
users to send HTTP requests using intuitive syntax.
HTTPie is used primarily for testing, trouble-free
debugging, and interacting with HTTP servers, web
services, and RESTful APIs. For further information on
HTTPie documentation, downloading, and installation,
see https://httpie.org/doc:
HTTPie comes with an intuitive UI and supports JSON.
It uses expressive and intuitive command syntax.
HTTPie allows for syntax highlighting, formatting, and colorized
terminal output.
HTTPie allows you to use HTTPS, proxies, and authentication.
It provides support for forms and file uploads.
It provides support for arbitrary request data and headers.
It enables Wget-like downloads and extensions.