# 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
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
var response Response
_, err := client.Get(ctx, "/resource", nil, &response)
if err != nil {
// handle error
}
POST Request
var response Response
_, err := client.Post(ctx, "/resource", bytes.NewReader(body), nil, &response)
if err != nil {
// handle error
}
# Functions
NewClient creates a new Client.
NewRetryTransport wraps the supplied http transport with a retryable implementation.
WithCredentials sets up oauth2 and replaces the default http client.
WithCustomClient replaces the default http client with the supplied one.
WithDefaultHeaders adds default headers to the client.
WithRateLimiter configures a rate limiter with the supplied limit (per minute).
# Constants
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Structs
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Type aliases
No description provided by the author