Documentation
¶
Overview ¶
Package httpio provides a simple HTTP client with streaming capabilities
Index ¶
- Variables
- type Client
- func (c *Client) DELETE(ctx context.Context, path string) (*client.Response, error)
- func (c *Client) Do(req *http.Request) (*http.Response, error)
- func (c *Client) GET(ctx context.Context, path string) (*client.Response, error)
- func (c *Client) GetMiddlewares() []middleware.Middleware
- func (c *Client) HEAD(ctx context.Context, path string) (*client.Response, error)
- func (c *Client) NewRequest(method, path string) *client.Request
- func (c *Client) OPTIONS(ctx context.Context, path string) (*client.Response, error)
- func (c *Client) PATCH(ctx context.Context, path string, body interface{}) (*client.Response, error)
- func (c *Client) POST(ctx context.Context, path string, body interface{}) (*client.Response, error)
- func (c *Client) PUT(ctx context.Context, path string, body interface{}) (*client.Response, error)
- func (c *Client) WithBaseURL(baseURL string) *Client
- func (c *Client) WithConnectionPool(maxIdleConns, maxConnsPerHost, maxIdleConnsPerHost int, ...) *Client
- func (c *Client) WithHeader(key, value string) *Client
- func (c *Client) WithHeaders(headers map[string]string) *Client
- func (c *Client) WithMiddleware(m middleware.Middleware) *Client
- func (c *Client) WithMiddlewares(middlewares ...middleware.Middleware) func(*Client)
- func (c *Client) WithTimeout(timeout time.Duration) *Client
- type Middleware
- type MiddlewareFunc
- type Request
- type Response
- type SSEEvent
- type SSEEventFullHandlerFunc
- type SSEEventHandlerFunc
- type SSEEventSourceFullHandler
- type SSEEventSourceHandler
- type StreamOption
Constants ¶
This section is empty.
Variables ¶
var WithBufferSize = client.WithBufferSize
WithBufferSize sets the buffer size for stream reading
var WithByteDelimiter = client.WithByteDelimiter
WithByteDelimiter sets a byte delimiter for stream reading
var WithContentType = client.WithContentType
WithContentType sets the expected content type for the stream
var WithDelimiter = client.WithDelimiter
WithDelimiter sets the delimiter for line-based stream reading
Functions ¶
This section is empty.
Types ¶
type Client ¶ added in v0.2.0
type Client struct {
// contains filtered or unexported fields
}
Client is a wrapper around http.Client with additional functionality
func (*Client) GetMiddlewares ¶ added in v0.2.0
func (c *Client) GetMiddlewares() []middleware.Middleware
GetMiddlewares implements the client.HTTPClient interface
func (*Client) NewRequest ¶ added in v0.2.0
NewRequest creates a new request with the given method and URL
func (*Client) PATCH ¶ added in v0.2.0
func (c *Client) PATCH(ctx context.Context, path string, body interface{}) (*client.Response, error)
PATCH performs a PATCH request
func (*Client) WithBaseURL ¶ added in v0.2.0
WithBaseURL sets the base URL for all requests
func (*Client) WithConnectionPool ¶ added in v0.2.0
func (c *Client) WithConnectionPool(maxIdleConns, maxConnsPerHost, maxIdleConnsPerHost int, idleConnTimeout time.Duration) *Client
WithConnectionPool configures the connection pool settings for the HTTP client
func (*Client) WithHeader ¶ added in v0.2.0
WithHeader sets a header for all requests
func (*Client) WithHeaders ¶ added in v0.2.0
WithHeaders sets multiple headers for all requests
func (*Client) WithMiddleware ¶ added in v0.2.0
func (c *Client) WithMiddleware(m middleware.Middleware) *Client
WithMiddleware adds a middleware to the client's middleware chain Middlewares are applied in the order they are added
func (*Client) WithMiddlewares ¶ added in v0.2.0
func (c *Client) WithMiddlewares(middlewares ...middleware.Middleware) func(*Client)
WithMiddlewares allows adding multiple middlewares to the client
type Middleware ¶
type Middleware = middleware.Middleware
Middleware defines the interface for HTTP middleware
type MiddlewareFunc ¶ added in v0.2.0
type MiddlewareFunc = middleware.MiddlewareFunc
MiddlewareFunc is a function type for middleware that wraps an HTTP handler
type Response ¶ added in v0.2.0
Response wraps the standard http.Response with additional utility methods
type SSEEventFullHandlerFunc ¶ added in v0.2.0
type SSEEventFullHandlerFunc = client.EventFullHandlerFunc
EventFullHandlerFunc represents a function-based handler with lifecycle support
type SSEEventHandlerFunc ¶ added in v0.2.0
type SSEEventHandlerFunc = client.EventHandlerFunc
EventHandlerFunc is a function type for handling SSE events
type SSEEventSourceFullHandler ¶ added in v0.2.0
type SSEEventSourceFullHandler = client.EventSourceFullHandler
EventSourceFullHandler extends EventSourceHandler with lifecycle methods
type SSEEventSourceHandler ¶ added in v0.2.0
type SSEEventSourceHandler = client.EventSourceHandler
EventSourceHandler handles incoming Server-Sent Events
type StreamOption ¶
type StreamOption = client.StreamOption
StreamOption represents options for stream processing
Directories
¶
| Path | Synopsis |
|---|---|
|
example
|
|
|
custom-middleware
command
Package example demonstrates custom middleware implementations for httpio
|
Package example demonstrates custom middleware implementations for httpio |
|
stream
command
|
|
|
internal
|
|
|
client
Package client implements the internal HTTP request/response handling
|
Package client implements the internal HTTP request/response handling |
|
cache
Package cache provides HTTP response caching middleware for httpio.
|
Package cache provides HTTP response caching middleware for httpio. |
|
circuitbreaker
Package circuitbreaker provides a circuit breaker middleware implementation for httpio.
|
Package circuitbreaker provides a circuit breaker middleware implementation for httpio. |
|
headers
Package headers provides middleware for adding custom headers to HTTP requests.
|
Package headers provides middleware for adding custom headers to HTTP requests. |
|
oauth
Package oauth provides OAuth middleware for httpio clients.
|
Package oauth provides OAuth middleware for httpio clients. |
|
retry
Package retry provides a retry middleware implementation for httpio.
|
Package retry provides a retry middleware implementation for httpio. |