http
is a subset of curl that does one thing well: it follows Bearer authentication.
If you need to make a request against something that users Bearer authentication, it works like this:
GET http://actual.target.com/abc
- Receive a
Www-Authenticate: Bearer realm=http://somewhere.else.com,service=a.b.c
- Make a new request (probably with different credentials) to
http://somewhere.else.com
with the right parameters and crendetials - Get back a token, usually a Json Web Token.
- Make a new request to
GET http://actual.target.com/abc
with the token in the right header
The protocol is great... but testing against it is a pain. Docker registry v2 works like this... and testing against it is a pain.
http
comes to solve it.
http --realm-user jim:smith http://www.foo.com/abc
http
supports a subset of curl options, although it is growing.
-d BODY
or--data BODY
: sendBODY
as the body of the request-X METHOD
or--request METHOD
: use http methodMETHOD
, defaults toGET
-u USER:PASS
or--user USER:PASS
: useUSER
andPASS
as credentials for http Basic authentication--realm-user USER:PASS
: useUSER
andPASS
as credentials for authentication against the token auth service-H HEADER -H HEADER ... -H HEADER
or--header HEADER --header HEADER ... --header HEADER
: useHEADER
as headers for the http request. Use as many as you want.-i
or--include
: in addition to the body, print the http response headers-I
or--head
: print just the http response headers-V
or--verbose
: be verbose about what you are doing
http
is written in go, which means it is compiled locally for each platform (as of this writing, Linux and Mac). Just download and run
Built using go. Clone this repository and build. I used gb to build it.
MIT