Documentation
¶
Index ¶
- Variables
- func FetchUID(r *http.Request) (string, error)
- func HealthHandler(w http.ResponseWriter, _ *http.Request)
- func WriteCORSHeaders(w http.ResponseWriter, r *http.Request, origins []string)
- type Config
- type DefaultHeadersExtractor
- type HTTPServer
- func (s *HTTPServer) Address() string
- func (s *HTTPServer) Running() bool
- func (s *HTTPServer) SetupHandler(path string, handler http.Handler)
- func (s *HTTPServer) Shutdown(ctx context.Context) error
- func (s *HTTPServer) ShutdownCtx() context.Context
- func (s *HTTPServer) Start() error
- func (s *HTTPServer) StartAndAnnounce(name string) error
- func (s *HTTPServer) Stopped() bool
- type HeadersExtractor
- type RequestInfo
- type SSLConfig
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func HealthHandler ¶
func HealthHandler(w http.ResponseWriter, _ *http.Request)
HealthHandler always reponds with 200 status
func WriteCORSHeaders ¶
func WriteCORSHeaders(w http.ResponseWriter, r *http.Request, origins []string)
Types ¶
type Config ¶
type DefaultHeadersExtractor ¶
func (*DefaultHeadersExtractor) FromRequest ¶
func (h *DefaultHeadersExtractor) FromRequest(r *http.Request) map[string]string
type HTTPServer ¶
type HTTPServer struct {
// contains filtered or unexported fields
}
HTTPServer is wrapper over http.Server
func ForPort ¶
func ForPort(port string) (*HTTPServer, error)
ForPort creates new or returns the existing server for the specified port
func (*HTTPServer) Address ¶
func (s *HTTPServer) Address() string
Address returns server scheme://host:port
func (*HTTPServer) Running ¶
func (s *HTTPServer) Running() bool
Running returns true if server has been started
func (*HTTPServer) SetupHandler ¶
func (s *HTTPServer) SetupHandler(path string, handler http.Handler)
SetupHandler adds new handler to mux
func (*HTTPServer) Shutdown ¶
func (s *HTTPServer) Shutdown(ctx context.Context) error
Shutdown shuts down server gracefully.
func (*HTTPServer) ShutdownCtx ¶
func (s *HTTPServer) ShutdownCtx() context.Context
ShutdownCtx returns context for graceful shutdown. It must be used by HTTP handlers to termniates long-running requests (SSE, long-polling).
func (*HTTPServer) StartAndAnnounce ¶
func (s *HTTPServer) StartAndAnnounce(name string) error
StartAndAnnounce prints server info and starts server
func (*HTTPServer) Stopped ¶
func (s *HTTPServer) Stopped() bool
Stopped return true iff server has been stopped by user
type HeadersExtractor ¶
type RequestInfo ¶
type RequestInfo struct {
UID string
URL string
Headers *map[string]string
// contains filtered or unexported fields
}
func NewRequestInfo ¶
func NewRequestInfo(r *http.Request, extractor HeadersExtractor) (*RequestInfo, error)
func (*RequestInfo) AnyCableHeader ¶
func (i *RequestInfo) AnyCableHeader(key string) string
func (*RequestInfo) Param ¶
func (i *RequestInfo) Param(key string) string
Click to show internal directories.
Click to hide internal directories.