Documentation
¶
Overview ¶
Package httpclient provides an HTTP client with auth, retry, and pagination support.
Index ¶
- Variables
- func DetectContentType(body []byte, contentType string) bool
- func IsJSON(data []byte) bool
- func RedactSensitiveHeader(key, value string) string
- func RedactToken(token string) string
- func ShouldSkipAuth(url string, headers map[string]string, skipAuth bool) bool
- type Client
- type Formatter
- type MockTokenProvider
- type OutputFormat
- type RequestOptions
- type Response
- type TokenProvider
Constants ¶
This section is empty.
Variables ¶
var UserAgent = ""
UserAgent is the default User-Agent header value. It can be overridden by the caller.
var Version = "0.0.0-dev"
Version is the version string used in the User-Agent header. It can be overridden at build time or by the caller.
Functions ¶
func DetectContentType ¶
DetectContentType attempts to determine if content is binary
func RedactSensitiveHeader ¶
RedactSensitiveHeader redacts sensitive header values
func RedactToken ¶
RedactToken redacts sensitive parts of an authorization token
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps HTTP client functionality
type Formatter ¶
type Formatter struct {
// contains filtered or unexported fields
}
Formatter handles response formatting and output
func NewFormatter ¶
NewFormatter creates a new formatter
func (*Formatter) WriteOutput ¶
WriteOutput writes the formatted output to the appropriate destination
type MockTokenProvider ¶
MockTokenProvider is a mock implementation of TokenProvider for testing.
type OutputFormat ¶
type OutputFormat string
OutputFormat represents the output format type
const ( FormatAuto OutputFormat = "auto" FormatJSON OutputFormat = "json" FormatRaw OutputFormat = "raw" )
type RequestOptions ¶
type RequestOptions struct {
Method string
URL string
Body io.Reader
Headers map[string]string
Scope string
SkipAuth bool
Verbose bool
Timeout time.Duration
Insecure bool
FollowRedirects bool
MaxRedirects int
OutputFile string
Format string
TokenProvider TokenProvider
Binary bool
Retry int
MaxResponseSize int64
Paginate bool
}
RequestOptions contains options for HTTP requests