gurl is an HTTP client written in Go
go get github.com/yuzuy/gurl/cmd/gurl
gurl http://localhost:8080/v1/hello
- -d - Input the request body
- -H - Input the request header
- -L - Follow redirects
- -u - Input username and password for Basic Auth
- -v - Output the verbose log
- -X - Input the http method
gurl allows you to set the default header.
If you input the header that has the same key as the default header, override the default header.
gurl dh add localhost:8080 "Authorization:Bearer foobar"
gurl dh list
# Output:
# localhost:8080:
# Authorization: Bearer foobar
gurl http://localhost:8080 # == gurl -H "Authorization:Bearer foobar" http://localhost:8080
gurl dh rm localhost:8080 Authorization
gurl dh list localhost:8080
# Output:
# localhost:8080:
# pattern matching
gurl dh add "localhost:8080/v1/*" "Authorization:Bearer fizzbuzz"
gurl http://localhost:8080/v1/foo # == gurl -H "Authorization:Bearer fizzbuzz" http://localhost:8080/v1/foo
gurl http://localhost:8080 # == gurl http://localhost:8080
# endpoint
gurl dh add localhost:8080/v1/bar "Authorization:Bearer yuzuy"
gurl http://localhost:8080/v1/bar # == gurl -H "Authorization:Bearer yuzuy" http://localhost:8080/v1/bar
gurl http://localhost:8080/v1/bar/foo # == gurl -H "Authorization:Bearer fizzbuzz" http://localhost:8080/v1/bar/foo