Documentation ¶
Overview ¶
Package client provides some http helpers to create http clients and executors
Index ¶
- Constants
- Variables
- func DefaultHTTPStatusHandler(ctx context.Context, resp *http.Response) (*http.Response, error)
- func ErrorHTTPStatusHandler(ctx context.Context, resp *http.Response) (*http.Response, error)
- func NewHTTPClient(ctx context.Context) *http.Client
- func NoOpHTTPStatusHandler(_ context.Context, resp *http.Response) (*http.Response, error)
- type HTTPClientFactory
- type HTTPRequestExecutor
- type HTTPResponseError
- type HTTPStatusHandler
- type NamedHTTPResponseError
Constants ¶
View Source
const Namespace = "github.com/starvn/turbo/transport/http/client"
Variables ¶
View Source
var ErrInvalidStatusCode = errors.New("Invalid status code")
Functions ¶
func ErrorHTTPStatusHandler ¶
Types ¶
type HTTPRequestExecutor ¶
func DefaultHTTPRequestExecutor ¶
func DefaultHTTPRequestExecutor(clientFactory HTTPClientFactory) HTTPRequestExecutor
type HTTPResponseError ¶
type HTTPResponseError struct { Code int `json:"http_status_code"` Msg string `json:"http_body,omitempty"` }
func (HTTPResponseError) Error ¶
func (r HTTPResponseError) Error() string
func (HTTPResponseError) StatusCode ¶
func (r HTTPResponseError) StatusCode() int
type HTTPStatusHandler ¶
func DetailedHTTPStatusHandler ¶
func DetailedHTTPStatusHandler(name string) HTTPStatusHandler
func GetHTTPStatusHandler ¶
func GetHTTPStatusHandler(remote *config.Backend) HTTPStatusHandler
type NamedHTTPResponseError ¶
type NamedHTTPResponseError struct { HTTPResponseError // contains filtered or unexported fields }
func (NamedHTTPResponseError) Name ¶
func (r NamedHTTPResponseError) Name() string
Click to show internal directories.
Click to hide internal directories.