Documentation
¶
Overview ¶
Package http is a generated GoMock package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetGitHubTokenFromEnv ¶ added in v1.203.0
func GetGitHubTokenFromEnv() string
GetGitHubTokenFromEnv retrieves GitHub token from the global configuration. This function respects the standard Atmos precedence order:
- --github-token CLI flag (via viper, only available for toolchain commands)
- ATMOS_GITHUB_TOKEN environment variable
- GITHUB_TOKEN environment variable
The viper binding is configured in cmd/toolchain/toolchain.go for toolchain commands. For non-toolchain commands, we fall back to direct environment variable lookup.
Types ¶
type Client ¶
type Client interface {
// Do performs an HTTP request and returns the response.
Do(req *http.Request) (*http.Response, error)
}
Client defines the interface for making HTTP requests. This interface allows for easy mocking in tests.
type ClientOption ¶ added in v1.203.0
type ClientOption func(*DefaultClient)
ClientOption is a functional option for configuring the DefaultClient.
func WithGitHubToken ¶ added in v1.203.0
func WithGitHubToken(token string) ClientOption
WithGitHubToken sets the GitHub token for authenticated requests. Wraps the existing transport instead of replacing it to allow composition with WithTransport.
func WithTimeout ¶ added in v1.203.0
func WithTimeout(timeout time.Duration) ClientOption
WithTimeout sets the HTTP client timeout.
func WithTransport ¶ added in v1.203.0
func WithTransport(transport http.RoundTripper) ClientOption
WithTransport sets a custom HTTP transport.
type DefaultClient ¶
type DefaultClient struct {
// contains filtered or unexported fields
}
DefaultClient is the default HTTP client implementation.
func NewDefaultClient ¶
func NewDefaultClient(opts ...ClientOption) *DefaultClient
NewDefaultClient creates a new DefaultClient with optional configuration.
type GitHubAuthenticatedTransport ¶ added in v1.203.0
type GitHubAuthenticatedTransport struct {
Base http.RoundTripper
GitHubToken string
}
GitHubAuthenticatedTransport wraps an http.Transport to add GitHub token authentication.
type MockClient ¶
type MockClient struct {
// contains filtered or unexported fields
}
MockClient is a mock of Client interface.
func NewMockClient ¶
func NewMockClient(ctrl *gomock.Controller) *MockClient
NewMockClient creates a new mock instance.
func (*MockClient) EXPECT ¶
func (m *MockClient) EXPECT() *MockClientMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
type MockClientMockRecorder ¶
type MockClientMockRecorder struct {
// contains filtered or unexported fields
}
MockClientMockRecorder is the mock recorder for MockClient.