https://github.com/mengdu/h3
A simple encapsulation of Golang HTTP client.
https://github.com/mengdu/h3
client h3 http
Last synced: 8 months ago
JSON representation
A simple encapsulation of Golang HTTP client.
- Host: GitHub
- URL: https://github.com/mengdu/h3
- Owner: mengdu
- License: mit
- Created: 2024-01-03T11:56:38.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-01-05T07:00:32.000Z (over 2 years ago)
- Last Synced: 2025-07-30T01:51:15.268Z (8 months ago)
- Topics: client, h3, http
- Language: Go
- Homepage: https://pkg.go.dev/github.com/mengdu/h3
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# H3
A simple encapsulation of Golang HTTP client.
```go
package demo
import "fmt"
func main() {
client := h3.New()
client.BaseURL = "https://httpbin.org"
req := client.Req("POST", "/anything")
// application/json
form := h3.Json{}
if err := form.Set(map[string]interface{}{
"a": 1,
"b": []string{"1", "2", "3"},
}); err != nil {
panic(err)
}
req.Body = form.Form()
res, err := client.Do(req)
if err != nil {
panic(err)
}
data := map[string]interface{}{}
if err := res.Json(&data); err != nil {
panic(err)
}
fmt.Printf("%#v\n", data)
}
```
[More examples](./examples/)