README
¶
Configuration through environment variables
This SDK can be configured via the environment variables.
Konnect domain
Konnect domain can be customized via KONG_CUSTOM_DOMAIN
environment variable.
This is useful when testing against a development environment or a custom domain.
This is optional and the default value is konghq.com
.
Request and response logging
Request and response logging can be enabled via:
KONNECT_SDK_HTTP_DUMP_REQUEST
: Set totrue
to log request bodies.KONNECT_SDK_HTTP_DUMP_RESPONSE
: Set totrue
to log response bodies.KONNECT_SDK_HTTP_DUMP_RESPONSE_ERROR
: Set totrue
to log response bodies only when the response status code is an error.
Documentation
¶
Index ¶
- type APIURLRequestHook
- type AfterErrorContext
- type AfterSuccessContext
- type BeforeRequestContext
- type FailEarly
- type GlobalAPIURLRequestHook
- type HTTPClient
- type HTTPDumpRequestHook
- type HTTPDumpResponseErrorHook
- type HTTPDumpResponseHook
- type HookContext
- type Hooks
- func (h *Hooks) AfterError(hookCtx AfterErrorContext, res *http.Response, err error) (*http.Response, error)
- func (h *Hooks) AfterSuccess(hookCtx AfterSuccessContext, res *http.Response) (*http.Response, error)
- func (h *Hooks) BeforeRequest(hookCtx BeforeRequestContext, req *http.Request) (*http.Request, error)
- func (h *Hooks) SDKInit(baseURL string, client HTTPClient) (string, HTTPClient)
- type UserAgentPreRequestHook
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIURLRequestHook ¶
type APIURLRequestHook struct {
CustomDomain string
}
func (*APIURLRequestHook) BeforeRequest ¶
func (i *APIURLRequestHook) BeforeRequest(hookCtx BeforeRequestContext, req *http.Request) (*http.Request, error)
Replace `.konghq.com` with the custom domain set in the `KONG_CUSTOM_DOMAIN` environment variable.
type AfterErrorContext ¶
type AfterErrorContext struct {
HookContext
}
type AfterSuccessContext ¶
type AfterSuccessContext struct {
HookContext
}
type BeforeRequestContext ¶
type BeforeRequestContext struct {
HookContext
}
type GlobalAPIURLRequestHook ¶
type GlobalAPIURLRequestHook struct{}
func (*GlobalAPIURLRequestHook) BeforeRequest ¶
func (i *GlobalAPIURLRequestHook) BeforeRequest(hookCtx BeforeRequestContext, req *http.Request) (*http.Request, error)
type HTTPClient ¶
HTTPClient provides an interface for supplying the SDK with a custom HTTP client
type HTTPDumpRequestHook ¶
type HTTPDumpRequestHook struct{}
HTTPDumpRequestHook is a hook that dumps the request to stdout.
func (*HTTPDumpRequestHook) BeforeRequest ¶
func (i *HTTPDumpRequestHook) BeforeRequest(hookCtx BeforeRequestContext, req *http.Request) (*http.Request, error)
BeforeRequest dumps the request to stdout if enabled.
type HTTPDumpResponseErrorHook ¶
type HTTPDumpResponseErrorHook struct{}
HTTPDumpResponseErrorHook is a hook that dumps the error response to stdout.
func (*HTTPDumpResponseErrorHook) AfterError ¶
func (i *HTTPDumpResponseErrorHook) AfterError(hookCtx AfterErrorContext, res *http.Response, err error) (*http.Response, error)
AfterError dumps the error response to stdout if enabled.
type HTTPDumpResponseHook ¶
type HTTPDumpResponseHook struct{}
HTTPDumpResponseHook is a hook that dumps the response to stdout.
func (*HTTPDumpResponseHook) AfterSuccess ¶
func (i *HTTPDumpResponseHook) AfterSuccess(hookCtx AfterSuccessContext, res *http.Response) (*http.Response, error)
AfterSuccess dumps the response to stdout if enabled.
type HookContext ¶
type Hooks ¶
type Hooks struct {
// contains filtered or unexported fields
}
func (*Hooks) AfterError ¶
func (*Hooks) AfterSuccess ¶
func (*Hooks) BeforeRequest ¶
func (*Hooks) SDKInit ¶
func (h *Hooks) SDKInit(baseURL string, client HTTPClient) (string, HTTPClient)
type UserAgentPreRequestHook ¶
type UserAgentPreRequestHook struct{}
func (*UserAgentPreRequestHook) BeforeRequest ¶
func (i *UserAgentPreRequestHook) BeforeRequest(hookCtx BeforeRequestContext, req *http.Request) (*http.Request, error)