Documentation ¶
Index ¶
- func EncodeResponse(_ context.Context, w http.ResponseWriter, response interface{}) error
- func ErrorEncoder(_ context.Context, err error, w http.ResponseWriter)
- func NewServer(options ...ServerOption) *server
- type ContextFn
- type EndpointFn
- type EndpointMiddlewareFn
- type EndpointOption
- type EndpointOptionFn
- type ErrorResponseEncoderFn
- type Headerer
- type Request
- type ResponseEncoderFn
- type ServerOption
- type ServerOptionFn
- type StatusCoder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodeResponse ¶
func EncodeResponse(_ context.Context, w http.ResponseWriter, response interface{}) error
func ErrorEncoder ¶
func ErrorEncoder(_ context.Context, err error, w http.ResponseWriter)
func NewServer ¶
func NewServer(options ...ServerOption) *server
Types ¶
type EndpointFn ¶
type EndpointMiddlewareFn ¶
type EndpointMiddlewareFn func(next EndpointFn) EndpointFn
type EndpointOption ¶
type EndpointOption interface {
Apply(*endpoint)
}
func WithContext ¶
func WithContext(ContextFn ContextFn) EndpointOption
func WithPreRequestMiddleware ¶
func WithPreRequestMiddleware(mds ...EndpointMiddlewareFn) EndpointOption
type EndpointOptionFn ¶
type EndpointOptionFn func(*endpoint)
func (EndpointOptionFn) Apply ¶
func (o EndpointOptionFn) Apply(e *endpoint)
type ErrorResponseEncoderFn ¶
type ErrorResponseEncoderFn func(ctx context.Context, err error, w http.ResponseWriter)
type Request ¶
type Request interface { AddCookie(c *http.Cookie) BasicAuth() (username string, password string, ok bool) Clone(ctx context.Context) *http.Request Context() context.Context Cookie(name string) (*http.Cookie, error) Cookies() []*http.Cookie FormFile(key string) (multipart.File, *multipart.FileHeader, error) FormValue(key string) string MultipartReader() (*multipart.Reader, error) ParseForm() error ParseMultipartForm(maxMemory int64) error PostFormValue(key string) string ProtoAtLeast(major int, minor int) bool Referer() string SetBasicAuth(username string, password string) UserAgent() string WithContext(ctx context.Context) *http.Request Write(w io.Writer) error WriteProxy(w io.Writer) error Body() io.ReadCloser Decode(v any) error Header() http.Header URL() *url.URL }
type ResponseEncoderFn ¶
type ResponseEncoderFn func(ctx context.Context, w http.ResponseWriter, response interface{}) error
type ServerOption ¶
type ServerOption interface {
Apply(*server)
}
func WithErrorResponseEncoder ¶
func WithErrorResponseEncoder(e ErrorResponseEncoderFn) ServerOption
func WithResponseEncoder ¶
func WithResponseEncoder(e ResponseEncoderFn) ServerOption
type ServerOptionFn ¶
type ServerOptionFn func(*server)
func (ServerOptionFn) Apply ¶
func (o ServerOptionFn) Apply(s *server)
type StatusCoder ¶
type StatusCoder interface {
StatusCode() int
}
Source Files ¶
Click to show internal directories.
Click to hide internal directories.