Documentation ¶
Overview ¶
Package util provides basic utilities which come in handy for constructing real pullcord installs.
Index ¶
Constants ¶
const ( // Forbidden is a canned StandardResponse for an HTTP 403 Forbidden = StandardResponse(403) // NotFound is a canned StandardResponse for an HTTP 404 NotFound = StandardResponse(404) // InternalServerError is a canned StandardResponse for an HTTP 500 InternalServerError = StandardResponse(500) // NotImplemented is a canned StandardResponse for an HTTP 501 NotImplemented = StandardResponse(501) )
const MinimumStandardResponse = 100
MinimumStandardResponse is the lower limit of acceptable HTTP response codes for which a StandardResponse can be created.
Variables ¶
This section is empty.
Functions ¶
func LoadPlugin ¶
func LoadPlugin()
LoadPlugin being called forces the package to be loaded in order to ensure that the resource types are registered during the package's Init.
Types ¶
type ExactPathRouter ¶
ExactPathRouter is a net/http.Handler that routes to other handlers based on an exactly matching path, or an optional default handler.
func (*ExactPathRouter) ServeHTTP ¶
func (r *ExactPathRouter) ServeHTTP(w http.ResponseWriter, req *http.Request)
func (*ExactPathRouter) UnmarshalJSON ¶
func (r *ExactPathRouter) UnmarshalJSON(input []byte) error
UnmarshalJSON implements encoding/json.Unmarshaler.
type LandingHandler ¶
type LandingHandler struct { }
LandingHandler is a net/http.Handler that acts as a default landing page for a (presumably not-yet-production) Pullcord instance.
func (*LandingHandler) ServeHTTP ¶
func (l *LandingHandler) ServeHTTP( w http.ResponseWriter, req *http.Request, )
NewLandingHandler generates an http.Handler that produces a simple landing page.
func (*LandingHandler) UnmarshalJSON ¶
func (l *LandingHandler) UnmarshalJSON(data []byte) error
UnmarshalJSON implements encoding/json.Unmarshaler.
type StandardResponse ¶
type StandardResponse int
StandardResponse implements a net/http.Handler that gives a canned version of the appropriate response for some HTTP code. For example, rather than going to the trouble of creating another net/http.Handler to deal with a request for a non-existent page, you could instead cast the literal integer 404 as a StandardResponse and the appropriate action will be taken (so long as the canned response this implementation provides will suffice).
func (StandardResponse) ServeHTTP ¶
func (s StandardResponse) ServeHTTP(w http.ResponseWriter, r *http.Request)
func (*StandardResponse) UnmarshalJSON ¶
func (s *StandardResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON implements encoding/json.Unmarshaler.