Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nxdir-s/httpc
httpc is a net/http client wrapper that handles OAuth, Open Telemetry instrumentation, retries and rate limiting
https://github.com/nxdir-s/httpc
go golang http http-client opentelemetry opentelemetry-go
Last synced: about 2 months ago
JSON representation
httpc is a net/http client wrapper that handles OAuth, Open Telemetry instrumentation, retries and rate limiting
- Host: GitHub
- URL: https://github.com/nxdir-s/httpc
- Owner: nxdir-s
- License: mit
- Created: 2024-09-09T05:18:48.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-11-20T17:40:07.000Z (about 2 months ago)
- Last Synced: 2024-11-20T18:34:36.938Z (about 2 months ago)
- Topics: go, golang, http, http-client, opentelemetry, opentelemetry-go
- Language: Go
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# HttpC
This repository contains an `net/http` client wrapper that handles authentication and can be configured with rate limiting, retries and Open Telemetry instrumentation.
Example client setup
```go
cfg := &httpc.Config{
BaseUrl: "google.com",
Timeout: 10,
RetryEnabled: true,
TlsConfig: &tls.Config{
InsecureSkipVerify: false,
MinVersion: tls.VersionTLS12,
},
}client, err := httpc.NewClient(ctx, cfg)
if err != nil {
// handle error
}
```GET Request
```go
var response Response
_, err := client.Get(ctx, "/resource", nil, &response)
if err != nil {
// handle error
}
```POST Request
```go
var response Response
_, err := client.Post(ctx, "/resource", bytes.NewReader(body), nil, &response)
if err != nil {
// handle error
}
```