Documentation
¶
Overview ¶
Package http provides core HTTP server functionality and types for building REST and SOAP services. It includes a server implementation, handler wrapper, and middleware support for request processing.
nolint:mnd
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HandlerFunc ¶
HandlerFunc is the signature for HTTP handlers that process requests in a context-aware manner. Handlers should return an error to indicate processing failure.
type Middleware ¶
type Middleware func(next HandlerFunc) HandlerFunc
Middleware is a function that wraps a HandlerFunc to add cross-cutting concerns such as logging, authentication, or metrics collection.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server wraps an http.Server with additional functionality for handler management. It provides graceful shutdown and handler upgrade capabilities.
func NewServer ¶
func NewServer(logger log.Logger, opts ...ServerOption) *Server
NewServer creates a new HTTP server with the specified logger and options. Default timeouts are set: 3 seconds for ReadHeaderTimeout and 120 seconds for IdleTimeout. Server is safe for concurrent use.
func (*Server) ListenAndServe ¶
ListenAndServe starts the server on the specified address. It creates a TCP listener and delegates to Serve.
func (*Server) Serve ¶
Serve accepts incoming connections on the specified listener and handles requests. It returns nil when the server is gracefully shut down.
type ServerOption ¶
type ServerOption func(*Server)
ServerOption is a function that configures a Server instance.
func WithServer ¶
func WithServer(server *http.Server) ServerOption
WithServer allows providing a custom *http.Server for advanced configuration.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package apierrors provides HTTP error handling with structured error responses.
|
Package apierrors provides HTTP error handling with structured error responses. |
|
bench
module
|
|
|
Package endpoint provides a high-level abstraction for building HTTP endpoints with automatic request/response handling, validation, and middleware support.
|
Package endpoint provides a high-level abstraction for building HTTP endpoints with automatic request/response handling, validation, and middleware support. |
|
buffer
Package buffer provides a ResponseWriter wrapper that buffers request and response bodies.
|
Package buffer provides a ResponseWriter wrapper that buffers request and response bodies. |
|
httplog
Package httplog provides HTTP request/response logging middleware.
|
Package httplog provides HTTP request/response logging middleware. |
|
Package httpcli provides a high-level HTTP client with support for middleware, retries, and flexible request/response handling.
|
Package httpcli provides a high-level HTTP client with support for middleware, retries, and flexible request/response handling. |
|
Package httpclix provides extended HTTP client functionality including load balancing, logging, and observability middleware.
|
Package httpclix provides extended HTTP client functionality including load balancing, logging, and observability middleware. |
|
Package router provides HTTP request routing with metrics integration.
|
Package router provides HTTP request routing with metrics integration. |
|
Package soap provides SOAP message handling for XML-based web services.
|
Package soap provides SOAP message handling for XML-based web services. |
|
client
Package client provides a SOAP client for invoking SOAP web services.
|
Package client provides a SOAP client for invoking SOAP web services. |