Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrBadRequest = errors.New("bad request") ErrUnsupportedMediaType = errors.New("unsupported media type") )
Functions ¶
func Created ¶
func Created(w http.ResponseWriter, resp interface{}) error
func ErrorStatusCode ¶
func Handler ¶
func Handler(handler RequestHandler) http.Handler
Types ¶
type BookRequest ¶
type BookRequest struct { Title string `json:"title"` ISBN string `json:"isbn"` Authors []string `json:"authors"` }
func NewBookRequest ¶
func NewBookRequest(req *http.Request) (*BookRequest, error)
func (*BookRequest) IsValid ¶
func (req *BookRequest) IsValid() (ok bool)
type BooksHandler ¶
type BooksHandler struct {
// contains filtered or unexported fields
}
func (*BooksHandler) Post ¶
func (h *BooksHandler) Post(w http.ResponseWriter, r *http.Request) error
type RequestHandler ¶
type RequestHandler func(w http.ResponseWriter, req *http.Request) error
Click to show internal directories.
Click to hide internal directories.