Documentation ¶
Index ¶
- func ErrWriter(err error) func(writer io.Writer)
- func File(mime string, f io.Reader) func(req *http.Request) (int, string, func(io.Writer))
- func Handle(handlers ...any) func(w http.ResponseWriter, req *http.Request)
- func Html(str string) func(req *http.Request) (int, string, func(io.Writer))
- func JsonWriter(data any) func(writer io.Writer)
- func ReaderWriter(data io.Reader) func(writer io.Writer)
- func Redirect(url string) (int, string, func(io.Writer))
- func StringWriter(str string) func(writer io.Writer)
- type ChainHandler
- type ResponseBuilder
- func (rb *ResponseBuilder) As(contentType string) (int, string, func(io.Writer))
- func (rb *ResponseBuilder) AsHtml() (int, string, func(io.Writer))
- func (rb *ResponseBuilder) AsJson() (int, string, func(io.Writer))
- func (rb *ResponseBuilder) AsTextPlain() (int, string, func(io.Writer))
- func (rb *ResponseBuilder) Body(body any) *ResponseBuilder
- func (rb *ResponseBuilder) Status(status int) *ResponseBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func JsonWriter ¶
func StringWriter ¶
Types ¶
type ChainHandler ¶
type ChainHandler func(w http.ResponseWriter, req *http.Request) bool
var Get ChainHandler = Method("GET")
var Path ChainHandler = Method("PATCH")
var Post ChainHandler = Method("POST")
var Put ChainHandler = Method("PUT")
func BasicAuthHandler ¶
func BasicAuthHandler(user, pass string) ChainHandler
func Method ¶
func Method(method string) ChainHandler
func NopHandler ¶ added in v0.5.1
func NopHandler() ChainHandler
type ResponseBuilder ¶
type ResponseBuilder struct {
// contains filtered or unexported fields
}
func ErrBadRequest ¶
func ErrBadRequest(body any) *ResponseBuilder
func ErrInternal ¶
func ErrInternal(body any) *ResponseBuilder
func ErrNotFound ¶
func ErrNotFound(body any) *ResponseBuilder
func NewResponse ¶
func NewResponse() *ResponseBuilder
func Ok ¶
func Ok(body any) *ResponseBuilder
func (*ResponseBuilder) AsTextPlain ¶
func (rb *ResponseBuilder) AsTextPlain() (int, string, func(io.Writer))
func (*ResponseBuilder) Body ¶
func (rb *ResponseBuilder) Body(body any) *ResponseBuilder
func (*ResponseBuilder) Status ¶
func (rb *ResponseBuilder) Status(status int) *ResponseBuilder
Click to show internal directories.
Click to hide internal directories.