Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHandler ¶
func NewHandler[Request any, Response any]( op operation.Operation[Request, Response], requestDecoder RequestDecoder[Request], responseEncoder ResponseEncoder[Response], errorEncoder ErrorEncoder, options ...HandlerOption, ) http.Handler
NewHandler returns a new HTTP handler that wraps the given operation.Operation.
Types ¶
type ErrorEncoder ¶
ErrorEncoder is responsible for encoding an error to the ResponseWriter. Users are encouraged to use custom ErrorEncoders to encode HTTP errors to their clients, and will likely want to pass and check for their own error types. See the example shipping/handling service.
type ErrorHandler ¶
ErrorHandler receives a transport error to be processed for diagnostic purposes. Usually this means logging the error.
type HandlerOption ¶
type HandlerOption interface {
// contains filtered or unexported methods
}
func WithErrorHandler ¶
func WithErrorHandler(errorHandler ErrorHandler) HandlerOption
func WithOperationName ¶
func WithOperationName(name string) HandlerOption
func WithOperationNameFunc ¶
func WithOperationNameFunc(fn func(ctx context.Context) string) HandlerOption
type RequestDecoder ¶
type ResponseEncoder ¶
Click to show internal directories.
Click to hide internal directories.