Documentation
¶
Index ¶
- Variables
- func DecodeJSONBody(w http.ResponseWriter, r *http.Request, dst interface{}) error
- func Http405(w http.ResponseWriter, allowed ...string)
- func HttpXXX(w http.ResponseWriter, status int)
- type MalformedRequestError
- type Server
- func (s *Server) EnableProfiler(addr string) error
- func (s *Server) Handle(pattern string, handler http.Handler)
- func (s *Server) HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
- func (s *Server) Handler(r *http.Request) (h http.Handler, pattern string)
- func (s *Server) Start(listenAddr string) error
- func (s *Server) Started() bool
- func (s *Server) Stop()
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrServerAlreadyStarted = errors.New("server already started")
Functions ¶
func DecodeJSONBody ¶ added in v0.1.2
func DecodeJSONBody(w http.ResponseWriter, r *http.Request, dst interface{}) error
func Http405 ¶
func Http405(w http.ResponseWriter, allowed ...string)
func HttpXXX ¶
func HttpXXX(w http.ResponseWriter, status int)
Types ¶
type MalformedRequestError ¶ added in v0.1.2
func (*MalformedRequestError) Error ¶ added in v0.1.2
func (mr *MalformedRequestError) Error() string
func (*MalformedRequestError) Write ¶ added in v0.1.2
func (mr *MalformedRequestError) Write(w http.ResponseWriter)
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
A wrapper around http.Server with some extra functionality.
func (*Server) EnableProfiler ¶ added in v0.1.2
EnableProfiler will cause Start() to also start a net/http/pprof listening at addr. Calling it after Start() returns a ServerAlreadyStartedError.
func (*Server) HandleFunc ¶ added in v0.1.2
Click to show internal directories.
Click to hide internal directories.