https://github.com/ghifari160/zei
Go HTTP Client library built atop the standard library's net/http.Client.
https://github.com/ghifari160/zei
golang golang-library http http-client
Last synced: 8 months ago
JSON representation
Go HTTP Client library built atop the standard library's net/http.Client.
- Host: GitHub
- URL: https://github.com/ghifari160/zei
- Owner: Ghifari160
- License: mit
- Created: 2025-07-22T00:44:29.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2025-07-22T05:53:38.000Z (9 months ago)
- Last Synced: 2025-07-22T07:43:20.559Z (9 months ago)
- Topics: golang, golang-library, http, http-client
- Language: Go
- Homepage:
- Size: 15.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Zei
Go HTTP Client library built atop the standard library's [net/http.Client].
## Install
``` shell
go get -u github.com/ghifari160/zei
```
## Usage
[Documentation]
### Quick Start
``` go
package main
import "github.com/ghifari160/zei"
func main() {
client := zei.New(&zei.Config{})
resp, err := client.Get("http://example.com/")
if err != nil {
// Handle error
}
defer resp.Body.Close()
// ...
}
```
### Set user agent
``` go
client := zei.New(&zei.Config{UserAgent: "App/1.0"})
resp, err := client.Get("http://example.com/")
```
### Set timeout
``` go
client := zei.New(&zei.Config{Timeout: 1 * time.Minute})
resp, err := client.Get("http://example.com/")
```
### Set authorization
``` go
config := zei.Config{}
// Basic Authentication
config.SetBasicAuth("username", "password")
// Bearer Authentication
config.SetBearerAuth("token_value")
client := zei.New(&config)
resp, err := client.Get("http://example.com/")
```
[Documentation]: https://pkg.go.dev/github.com/ghifari160/zei
[net/http.Client]: https://pkg.go.dev/net/http#Client