Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/teran/go-http-client
HTTP Client for Go to ease interaction with web services, especially APIs
https://github.com/teran/go-http-client
go golang http http-client httpclient
Last synced: about 1 month ago
JSON representation
HTTP Client for Go to ease interaction with web services, especially APIs
- Host: GitHub
- URL: https://github.com/teran/go-http-client
- Owner: teran
- License: apache-2.0
- Created: 2024-03-29T20:42:07.000Z (10 months ago)
- Default Branch: master
- Last Pushed: 2024-11-26T06:12:16.000Z (about 2 months ago)
- Last Synced: 2024-11-26T07:21:21.409Z (about 2 months ago)
- Topics: go, golang, http, http-client, httpclient
- Language: Go
- Homepage:
- Size: 38.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-http-client
[![Go](https://github.com/teran/go-http-client/actions/workflows/go.yml/badge.svg)](https://github.com/teran/go-http-client/actions/workflows/go.yml)
[![Go Report Card](https://goreportcard.com/badge/github.com/teran/go-http-client)](https://goreportcard.com/report/github.com/teran/go-http-client)
[![PkgGoDev](https://pkg.go.dev/badge/github.com/teran/go-http-client)](https://pkg.go.dev/github.com/teran/go-http-client)HTTP Client for Go to ease interaction with web services, especially APIs
## Usage example
```go
package mainimport (
"fmt""github.com/pkg/errors"
ghc "github.com/teran/go-http-client"
)// FIXME: Change this to your test JSON URL
const testURL = "http://........."func main() {
resp := map[string]string{}
errResp := map[string]string{}
statusCode, err := ghc.New().
Base(testURL).
Get("/json").
DoJSON(s.ctx, nil, &resp, &errResp)
if err != nil {
panic(errors.Wrap(err, fmt.Sprintf("%#v", errResp)))
}fmt.Printf("%#v", resp)
}```