Documentation ¶
Index ¶
- Constants
- func FormattedTimestamp() string
- func SendTextOnResponseBody(text string, w http.ResponseWriter)
- type HandlerFunc
- type HandlerFunctionMap
- type MessageResponse
- type Mux
- type MuxImpl
- func (mi *MuxImpl) AddHandler(address string, handler HandlerFunc)
- func (mi *MuxImpl) BadRequestError(w http.ResponseWriter, r *http.Request)
- func (mi *MuxImpl) CacheMaxAge() uint64
- func (mi *MuxImpl) Initialise() *MuxImpl
- func (mi *MuxImpl) InternalServerError(w http.ResponseWriter, r *http.Request, errorDetail error)
- func (mi *MuxImpl) Logger() logging.Logger
- func (mi *MuxImpl) MethodNotAllowedError(w http.ResponseWriter, r *http.Request)
- func (mi *MuxImpl) NotFoundError(w http.ResponseWriter, r *http.Request)
- func (mi *MuxImpl) RespondWithError(responseCode int, responseMsg string, w http.ResponseWriter, r *http.Request)
- func (mi *MuxImpl) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (mi *MuxImpl) Server() *http.Server
- func (mi *MuxImpl) ServiceUnavailableError(w http.ResponseWriter, r *http.Request, errorDetail error)
- func (mi *MuxImpl) SetCacheMaxAge(maxAgeInSeconds uint64)
- func (mi *MuxImpl) SetLogger(logger logging.Logger)
- func (mi *MuxImpl) Shutdown()
- func (mi *MuxImpl) Start(address string)
- func (mi *MuxImpl) UnsupportedMediaTypeError(w http.ResponseWriter, r *http.Request)
- func (mi *MuxImpl) WithCacheMaxAge(maxAgeInSeconds uint64) *MuxImpl
- func (mi *MuxImpl) WithType(muxType string) *MuxImpl
- type Response
- func (r *Response) Initialise() *Response
- func (r *Response) WithCacheControlMaxAge(cacheMaxAgeInSeconds uint64) *Response
- func (r *Response) WithCacheControlPublic() *Response
- func (r *Response) WithContentType(contentType string) *Response
- func (r *Response) WithCsvContent(content interface{}) *Response
- func (r *Response) WithJsonContent(content interface{}) *Response
- func (r *Response) WithResponseCode(responseCode int) *Response
- func (r *Response) WithTextContent(content string) *Response
- func (r *Response) WithTomlContent(content interface{}) *Response
- func (r *Response) WithWriter(writer http.ResponseWriter) *Response
- func (r *Response) Write() error
Constants ¶
View Source
const CacheControlHeaderKey = "Cache-Control"
View Source
const ContentTypeHeaderKey = "Content-Type"
View Source
const CsvMimeType = "text/csv"
View Source
const DefaultCacheMaxAgeInSeconds = 10
View Source
const DefaultResponseContentType = JsonMimeType
View Source
const JsonMimeType = "application/json"
View Source
const TextMimeType = "text/plain"
View Source
const TomlMimeType = "application/toml"
View Source
const UrlPathSeparator = "/"
Variables ¶
This section is empty.
Functions ¶
func FormattedTimestamp ¶
func FormattedTimestamp() string
func SendTextOnResponseBody ¶
func SendTextOnResponseBody(text string, w http.ResponseWriter)
Below useful for quick debugging.
Types ¶
type HandlerFunc ¶
type HandlerFunc http.HandlerFunc
type HandlerFunctionMap ¶
type HandlerFunctionMap map[*regexp.Regexp]HandlerFunc
func (HandlerFunctionMap) AddHandler ¶
func (m HandlerFunctionMap) AddHandler(addressPattern string, handler HandlerFunc)
type MessageResponse ¶
type MuxImpl ¶
type MuxImpl struct { http.ServeMux HandlerMap HandlerFunctionMap // contains filtered or unexported fields }
func (*MuxImpl) AddHandler ¶
func (mi *MuxImpl) AddHandler(address string, handler HandlerFunc)
func (*MuxImpl) BadRequestError ¶
func (mi *MuxImpl) BadRequestError(w http.ResponseWriter, r *http.Request)
func (*MuxImpl) CacheMaxAge ¶
func (*MuxImpl) Initialise ¶
func (*MuxImpl) InternalServerError ¶
func (*MuxImpl) MethodNotAllowedError ¶
func (mi *MuxImpl) MethodNotAllowedError(w http.ResponseWriter, r *http.Request)
func (*MuxImpl) NotFoundError ¶
func (mi *MuxImpl) NotFoundError(w http.ResponseWriter, r *http.Request)
func (*MuxImpl) RespondWithError ¶
func (*MuxImpl) ServiceUnavailableError ¶
func (*MuxImpl) SetCacheMaxAge ¶
func (*MuxImpl) UnsupportedMediaTypeError ¶
func (mi *MuxImpl) UnsupportedMediaTypeError(w http.ResponseWriter, r *http.Request)
func (*MuxImpl) WithCacheMaxAge ¶
type Response ¶
type Response struct { ResponseCode int ContentType string CacheControl string Content string Writer http.ResponseWriter // contains filtered or unexported fields }
func (*Response) Initialise ¶
func (*Response) WithCacheControlMaxAge ¶
func (*Response) WithCacheControlPublic ¶
func (*Response) WithContentType ¶
func (*Response) WithCsvContent ¶
func (*Response) WithJsonContent ¶
func (*Response) WithResponseCode ¶
func (*Response) WithTextContent ¶
func (*Response) WithTomlContent ¶
func (*Response) WithWriter ¶
func (r *Response) WithWriter(writer http.ResponseWriter) *Response
Click to show internal directories.
Click to hide internal directories.