Documentation
¶
Index ¶
- Constants
- Variables
- func AddAuthenticationHeader(authenticator auth.Authenticator, config configuration.Configuration, ...) error
- func ApplyTlsConfig(transport *http.Transport, insecure bool, caPool *x509.CertPool) *http.Transport
- func ConfigureProxy(transport *http.Transport, logger *zerolog.Logger, ...) *http.Transport
- func HandleResponse(res *http.Response, config configuration.Configuration) error
- func ShouldRequireAuthentication(apiUrl string, url *url.URL, additionalSubdomains []string, ...) (matchesPattern bool, err error)
- type AuthHeaderMiddleware
- type NetworkStackErrorHandlerMiddleware
- type ResponseMiddleware
- type RetryMiddleware
Constants ¶
View Source
const ConfigurationKeyRequestAttempts = "internal_network_request_max_attempts"
Variables ¶
View Source
var ErrAuthenticationFailed = fmt.Errorf("authentication failed")
ErrAuthenticationFailed indicates that authentication failed in the networking middleware.
Functions ¶
func AddAuthenticationHeader ¶
func AddAuthenticationHeader( authenticator auth.Authenticator, config configuration.Configuration, request *http.Request, ) error
AddAuthenticationHeader determines whether a request needs authentication, negotiates authorization and sets request headers if necessary.
If this fails due to an authentication error, the resulting error will match ErrAuthenticationFailed.
func ApplyTlsConfig ¶
func ConfigureProxy ¶
func HandleResponse ¶
func HandleResponse(res *http.Response, config configuration.Configuration) error
HandleResponse maps the response param to the error catalog error.
Types ¶
type AuthHeaderMiddleware ¶
type AuthHeaderMiddleware struct {
// contains filtered or unexported fields
}
func NewAuthHeaderMiddleware ¶
func NewAuthHeaderMiddleware( config configuration.Configuration, authenticator auth.Authenticator, roundTripper http.RoundTripper, ) *AuthHeaderMiddleware
type NetworkStackErrorHandlerMiddleware ¶
type NetworkStackErrorHandlerMiddleware struct {
// contains filtered or unexported fields
}
NetworkStackErrorHandlerMiddleware is a middleware that handles network errors that are not yet error catalog errors.
func NewNetworkStackErrorHandlerMiddleware ¶
func NewNetworkStackErrorHandlerMiddleware(roundTriper http.RoundTripper, errHandler networktypes.ErrorHandlerFunc) *NetworkStackErrorHandlerMiddleware
type ResponseMiddleware ¶
type ResponseMiddleware struct {
// contains filtered or unexported fields
}
func NewReponseMiddleware ¶
func NewReponseMiddleware(roundTriper http.RoundTripper, config configuration.Configuration, errHandler networktypes.ErrorHandlerFunc) *ResponseMiddleware
type RetryMiddleware ¶
type RetryMiddleware struct {
// contains filtered or unexported fields
}
func NewRetryMiddleware ¶
func NewRetryMiddleware(config configuration.Configuration, logger *zerolog.Logger, roundTripper http.RoundTripper) *RetryMiddleware
Click to show internal directories.
Click to hide internal directories.