Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mengdu/h3
A simple encapsulation of Golang HTTP client.
https://github.com/mengdu/h3
client h3 http
Last synced: 9 days 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 (11 months ago)
- Default Branch: main
- Last Pushed: 2024-01-05T07:00:32.000Z (11 months ago)
- Last Synced: 2024-01-05T09:24:48.396Z (11 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 demoimport "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/)