Documentation ¶
Index ¶
- Constants
- func ChiIDGetter(r *http.Request) (string, error)
- func Json(w http.ResponseWriter, status int, r interface{})
- func JsonError(w http.ResponseWriter, status int, err error)
- func Print(w http.ResponseWriter, status int, ctype string, content []byte)
- func ReadBody(r *http.Request) ([]byte, error)
- func ReadJsonBodyInto(w http.ResponseWriter, r *http.Request, target interface{}) error
- func TimestampHandler(w http.ResponseWriter, r *http.Request)
Constants ¶
View Source
const ( // ContentTypeJSON is the content type for JSON ContentTypeJSON = "application/json" // ContentTypeText is the content type for plain text ContentTypeText = "text/plain" )
Variables ¶
This section is empty.
Functions ¶
func ChiIDGetter ¶
ChiIDGetter for chi mux library
func JsonError ¶
func JsonError(w http.ResponseWriter, status int, err error)
JsonError to the browser in json format
func Print ¶
func Print(w http.ResponseWriter, status int, ctype string, content []byte)
Print sends data to the browser
func ReadJsonBodyInto ¶
func ReadJsonBodyInto(w http.ResponseWriter, r *http.Request, target interface{}) error
ReadJsonBodyInto reads json body into a target structure
func TimestampHandler ¶
func TimestampHandler(w http.ResponseWriter, r *http.Request)
TimestampHandler is a simple http handler that returns local time. Useful for status checking
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.