httpie-go (ht) is a user-friendly HTTP client CLI.
Requests can be issued with fewer types compared to curl.
Responses are displayed with syntax highlighting.
httpie-go is a clone of httpie. Since httpie-go is written in Go, it is a single binary and does not require a heavy runtime.
This example sends a GET request to http://httpbin.org/get.
$ ht GET httpbin.org/getThe second example sends a POST request with JSON body {"hello": "world", "foo": "bar"}.
$ ht POST httpbin.org/post hello=world foo=barYou can see the request that is being sent with -v option.
$ ht -v POST httpbin.org/post hello=world foo=barRequest HTTP headers can be specified in the form of key:value.
$ ht -v POST httpbin.org/post X-Foo:foobarDisable TLS verification.
$ ht --verify=no https://httpbin.org/getDownload a file.
$ ht --download <any url you want>Although httpie-go does not currently have documents, you can refer to the original httpie's documentation since httpie-go is a clone of httpie. Note that some minor options are yet to be implemented in httpie-go.
make
For non-standard Linux system like Android termux, use following method to avoid the DNS issue.
make build-termux
We use build tags or build constraints to separate build process for different platforms. Build tags are found at the top of the file as a comment. The file will be included only if the tag is present in the build command. eg:
//go:build cliGOOS=js GOARCH=wasm go build -tags=wasm  -o static/main.wasmgo build -tags=cli  -o static/main.wasmNote : The first line of the file should be followed by an empty line to make it a valid build tag statement.
If there is an ! mark then it means the not operation on the build tags.
//go:build !windowsThis will exclude the file if a windows build tag is used.(eg: while building for unix based systems)
Here we have wasm and cli build tags to switch between wasm and cli builds.
//+build is the older syntax for build tags, it's still recognized in Go. You can convert these statements into new syntax using gofmt command.
Example:
//go:build (linux && 386) || (darwin && !cgo)This means the file will be included if the target is either "linux" with "386" architecture or "darwin" without "cgo".
- GOOS: Sets the target operating system.
 - GOARCH: Sets the target architecture.
 
During a build, the following tags are considered:
- Target OS: Defined by 
runtime.GOOS(set byGOOS). - Target Architecture: Defined by 
runtime.GOARCH(set byGOARCH). - Architecture Features: For example, "amd64.v2".
 - "unix": If 
GOOSis a Unix-like system. - Compiler: Either "gc" or "gccgo".
 - "cgo": If 
cgois supported (set byCGO_ENABLED). - Go Version: Tags like "go1.1", "go1.12", etc.
 - Custom Tags: Provided by the 
-tagsflag. 
Files can have implicit build constraints based on their names:
- *_GOOS
 - *_GOARCH
 - *_GOOS_GOARCH
 
For example, source_windows_amd64.go is implicitly constrained to GOOS=windows and GOARCH=amd64.
- GOOS=android: Matches tags and files for both 
GOOS=linuxandandroid. - GOOS=illumos: Matches tags and files for both 
GOOS=solarisandillumos. - GOOS=ios: Matches tags and files for both 
GOOS=darwinandios. 
This ensures compatibility and proper inclusion of files for these specific platforms.
By using these build tags and environment variables, you can control the inclusion of files in your Go package based on the target platform.
